operand of postfix operator->

Discussion in 'C Programming' started by Rajesh S R, Apr 24, 2007.

  1. Rajesh S R

    Rajesh S R Guest

    Consider the following code
    int main()
    {
    struct name
    {
    long a;
    int b;
    long c;
    }s={3,4,5},*p;
    p=&s;

    printf("%d",*(int *)((char *)p+(unsigned int)&(((struct name*)0)-
    >b)));

    }



    (unsigned int)&(((struct name*)0)->b)

    Is the above expression valid according to C99?
    That is, Can we have a null pointer as an operand of postfix operator-
    > ?


    Thanks in advance for the reply.
     
    Rajesh S R, Apr 24, 2007
    #1
    1. Advertising

  2. Rajesh S R

    Chris Dollin Guest

    Rajesh S R wrote:

    > Consider the following code


    (fx:snip horrid code)

    You asked that already, and got two answers. What's the rush?

    --
    "Anything can happen in the next half-hour." /Stingray/

    Hewlett-Packard Limited Cain Road, Bracknell, registered no:
    registered office: Berks RG12 1HN 690597 England
     
    Chris Dollin, Apr 24, 2007
    #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. Kim JM
    Replies:
    1
    Views:
    1,705
    Riyaz
    Apr 2, 2004
  2. Rajesh S R

    Operand of postfix operator ->

    Rajesh S R, Apr 24, 2007, in forum: C Programming
    Replies:
    18
    Views:
    651
    Flash Gordon
    Apr 27, 2007
  3. Replies:
    29
    Views:
    35,104
  4. , India

    postfix vs prefix operator

    , India, Jun 23, 2007, in forum: C++
    Replies:
    8
    Views:
    801
  5. Chris Forone

    postfix operator++(int) with const

    Chris Forone, Jun 20, 2008, in forum: C++
    Replies:
    7
    Views:
    1,584
    James Kanze
    Jun 20, 2008
Loading...

Share This Page