I have the following code in C:
#include <stdio.h> void main() { printf("%d %d\n",sizeof(5),sizeof(5,5)); printf("%d %d\n",sizeof(5),sizeof(5.0,5)); printf("%d %d\n",sizeof(5),sizeof(5,5.0)); }
And I get the output:
4 4
4 4
4 8
I understand that sizeof(5) would return me the size of integer and sizeof(5.0) would return the size of a double, but why does it give the size of the rightmost operand in case more than one arguments are passed separated by comma? Why not the first argument or the collective size of all the arguments?
I am compiling online using OnlineGDB.com compiler for C.
Thanks for your help.