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

Re: sizeof(x)

Subject: Re: sizeofx
From: Harald van Dijk
Date: Sun, 30 Mar 2008 22:04:00 +0200
Newsgroups: comp.lang.c

On Sun, 30 Mar 2008 22:50:00 +0300, Ioannis Vranos wrote:
> 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.

You are; (x) is a perfectly valid expression, so there's no problem 
taking the size of (x).

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