Output of a program

Discussion in 'C Programming' started by sonu, Mar 14, 2006.

  1. sonu

    sonu Guest

    #include<stdio.h>

    main()
    {

    int x=10,y;

    y=sizeof(x++);

    printf("x=%d\ny=%d\n",x,y);

    }

    out put

    x=10;
    y=4

    Question : why x=10 Why not 11 becose its x++ inside sizeof operator.
    sonu, Mar 14, 2006
    #1
    1. Advertising

  2. On Tuesday 14 March 2006 06:54, sonu opined (in
    <>):

    > #include<stdio.h>
    >
    > main()
    > {
    >
    > int x=10,y;
    >
    > y=sizeof(x++);
    >
    > printf("x=%d\ny=%d\n",x,y);
    >
    > }
    >
    > out put
    >
    > x=10;
    > y=4
    >
    > Question : why x=10 Why not 11 becose its x++ inside sizeof operator.


    `sizeof` operator does not evaluate it's argument/operand, it just gives
    you its size.

    --
    BR, Vladimir

    You can never trust a woman; she may be true to you.
    Vladimir S. Oka, Mar 14, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Bentley

    Output / Debug window output bug?

    John Bentley, Sep 10, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    593
    John Bentley
    Sep 10, 2003
  2. chuck amadi
    Replies:
    1
    Views:
    490
    Larry Bates
    Jun 23, 2004
  3. Puneet
    Replies:
    16
    Views:
    1,126
    Daniel Vallstrom
    Mar 20, 2005
  4. Paul
    Replies:
    1
    Views:
    430
  5. jmr
    Replies:
    2
    Views:
    335
Loading...

Share This Page