I have written a simple C program and wanted to know if integer promotion is happening in it.
Please explain how integer promotion happens and how to avoid it?
/* start of main */
unsigned short int res;
unsigned short int bsp;
signed short int analog;
bsp = 2215;
analog = 2213;
if((signed short int)(bsp - analog) > 0){
res = bsp - analog;
printf("%d", res);
}
else{
res = analog - bsp;
printf("%d", res);
}