What happens here? sizeof(short_int_variable + char_variable)

前端 未结 5 1715
鱼传尺愫
鱼传尺愫 2020-12-03 22:03
#include 
 int main()        
{

           short int i = 20;

            char c = 97;

            printf(\"%d, %d, %d\\n\", sizeof(i), sizeof(c), s         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-03 23:02

    sizeof only works at compiletime to get the size of an expression.

    The following wont actually increase 'c':

    c = sizeof(++c);

    The expression sizeof(a + b) will return the largest type with unsigned having precedence

提交回复
热议问题