I wrote the code about sizeof
operator. If I write something like:
#include <stdio.h>
int main() {
char a[20];
printf("%zu\n", sizeof(a));
return 0;
}
Output:
20 // Ok, it's fine
But, If I use the comma operator like this:
#include <stdio.h>
int main() {
char a[20];
char b;
printf("%zu\n", sizeof(b, a));
return 0;
}
Output:
8 // Why the output 8?
So, I have a questions:
- Why does compiler give an output
8
in second example? - What is the behavior of
comma
operator intosizeof()
operator?