comp.lang.c
[Top] [All Lists]

sizeof(x)

Subject: sizeofx
From: Ioannis Vranos
Date: Sun, 30 Mar 2008 22:50:00 +0300
Newsgroups: comp.lang.c

In C99 it is mentioned:

"The sizeof operator yields the size (in bytes) of its operand, which
may be an expression or the parenthesized name of a type.".


If I am not wrong, this implies that

int x;

size_t y= sizeof(x);


is not valid.


and only the following is valid:


int x;

size_t y= sizeof x;


However I am puzzled, and thought the first was also valid in
C90/C95(/C++03).


<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy