Type Casting in C++
Learn how we can use type casting to convert one data type to another.
We'll cover the following
- Type casting
- The float to int conversion
- The char to int conversion
- Practice Exercise
- Problem 1: ASCII values (capital letters)
- Problem 2: ASCII values (capital letters)
- Problem 3: ASCII values (small letters)
- Problem 4: ASCII values (capital to small letters conversion)
- Problem 5: ASCII values (capital to small letters conversion)
- Problem 6: ASCII values (small to capital letters conversion)
- Practice Exercise
Type casting
We can convert the data type of a value to another data type using type casting.
Let us understand several conversions with the help of a few examples!
The float
to int
conversion
Look at the following example:
Get hands-on with 1200+ tech skills courses.