https://www.onlinegdb.com/edit/r1CBB9EHO
#include<stdio.h> int main() { short int i = 10; char c = 'a'; float p = 3.0; short int s = i+c; printf("%d\n", sizeof(short int)); //size of short int is 2 printf("%d\n", sizeof(char)); // size of char is 1 printf("%d\n", sizeof(c+i)); /*why is size of (char+short int) is 4 and not 2. It should be 2 because char should be promoted to short int, and then the result of (short int + short int) should be short int whose size should be 2. */ printf("%d", sizeof(s)); // though here it is 2 which is correct. return 0; }
https://wiki.sei.cmu.edu/confluence/display/c/INT02-C.+Understand+integer+conversion+rules
https://port70.net/~nsz/c/c11/n1570.html#6.3.1.1