Type casting is to change the data type of a variable according to programming need.
Type casting is done to assign values to dissimilar data type or to perform manipulation over dissimilar data type.

Type casting is of two kind :
First is performed by the system itself known as internal typecating.
Second is performed by the programmer known as explicit typecasting.
#include <stdio.h>
main() {
int sum = 17, count = 5;
double mean;
mean = (double) sum / count;
printf("Value of mean : %f\n", mean );
}
Integer Promotion
Integer promotion is the process in which value of "smaller" than int or unsigned int are converted either to int or unsigned int.
#include <stdio.h>
main() {
int i = 17;
char c = 'c'; /* ascii value is 99 */
int sum;
sum = i + c;
printf("Value of sum : %d\n", sum );
}
0 Comment(s)