Search code examples
cintegercharinteger-promotion

Is there a way to prove integral promotion to int?


In pure ansi C, is there any way to show that, given

char c1 = 1, c2 = 2;

the type of the following:

c1 + c2

is int?

Thanks.

NOTE: I know that according to standards it is, but in C++ you can use the typeid operator to show it. I'd like to be able to show c1 + c2 is an int in C.


Solution

  • How about checking using sizeof(). Didn't check it myself. Just an idea.