Is this a correct syntax (c code found on wikipedia)?
Posted
by m4design
on Stack Overflow
See other posts from Stack Overflow
or by m4design
Published on 2010-05-28T16:18:05Z
Indexed on
2010/05/28
16:22 UTC
Read the original article
Hit count: 154
I just found this code on wikipedia.
Link: http://en.wikipedia.org/wiki/Sizeof#Use
The code:
/* the following code illustrates the use of sizeof
* with variables and expressions (no parentheses needed),
* and with type names (parentheses needed)
*/
char c;
printf("%zu,%zu", sizeof c, sizeof(int));
It states that: "The z prefix should be used to print it, because the actual size can differ on each architecture."
I tried it on my compiler, but it gives the following result:
'zu,zu'
© Stack Overflow or respective owner