C & C++ Programming
Computer ScienceChapter 2 — Variables, Data Types and Operators
Lesson 2.5 : Type Conversion and Expressions
Reading & Interactive Lesson
Type Conversion and Expressions
Reading Material & Notes
Type Conversion and Expressions
Type conversion changes a value from one data type to another.
Implicit Conversion
The compiler automatically converts one type into another when required.
int a = 10;
float b = a;
Explicit Conversion
The programmer can explicitly convert a value using a cast.
float result = (float)10 / 3;
Expressions
An expression combines variables, constants and operators to produce a value.
int result = (10 + 5) * 2;
Understanding expressions and type conversion is important for writing correct calculations.
Course Curriculum
10 Chapters • 50 Lessons
Chapter 1 — Introduction to C and C++
5 Lessons
Chapter 2 — Variables, Data Types and Operators
5 Lessons
Chapter 3 — Conditional Statements and Loops
5 Lessons
Chapter 4 — Functions and Modular Programming
5 Lessons
Chapter 5 — Arrays and Strings
5 Lessons
Chapter 6 — Pointers and References
5 Lessons
Chapter 7 — Structures, Unions and Enumerations
5 Lessons
Chapter 8 — Object-Oriented Programming in C++
5 Lessons
Chapter 9 — Inheritance, Polymorphism and Templates
5 Lessons
Chapter 10 — File Handling and Mini Projects
5 Lessons