简体   繁体   中英

C - How does sizeof() of a function call works?

I have a following line in C:

printf("size of sizeof is %d\n", sizeof(printf("lol!\n")));

Am I getting the size of a function pointer here?

Here, sizeof evaluates the return type of printf . (Here an int )

printf() returns no. of char like "lol." has four character + null char(1) so it will return value 5(an int). And then sizeof() will return sizeof(int) ie 4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM