Afficher un message
Vieux 18/10/2007, 23h38   #6
Mark McIntyre
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: The sizeof operator : sizeof(++i)

On Thu, 18 Oct 2007 03:22:06 -0700, in comp.lang.c , Kislay
<kislaychandra@gmail.com> wrote:

>int main()
>{
> int i=10;
> printf("\n Size of i = %d ",sizeof(++i));


warning: incompatible implicit declaration of built-in function printf

> printf("\n i = %d ",i);


warning: no newline after output - text may not appear onscreen
(and on Linux, it doesn't...)

>On executing the above code , the value of i obtained as 10 .


I believe that sizeof() doesn't evaluate its operand (unless its a
VLA, I think), so the increment is never executed.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
  Réponse avec citation
 
Page generated in 0,04485 seconds with 9 queries