Type Casting is convert one datatype to another datatype. If you want to store long value into the integer then you can type cast ‘long’ to ‘int’. We can use cast operator for typecasting which is denoted by (type).In typecasting we are always convert the lower value to higher value for avoiding data loss.
Type Casting Example
Let’s see example to add character ASCII value to integer.
int number = 1;
char character = 'k'; /*ASCII value is 107 */
sum = number + character;
printf("Value of sum : %d\n", sum );