understand this function

Discussion in 'C' started by newmember, May 2, 2012.

  1. newmember

    newmember New Member

    Joined:
    May 2, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    what this function does :

    1.unsigned int a = 1;
    2. unsigned char b = *(unsigned char*)&a;
    3. return !!b;

    I don't understand completly what line number 2 does - it does casting on what : the value of a or the adress of a?

    thanks
     
  2. ashken

    ashken New Member

    Joined:
    Oct 22, 2010
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    the address of a is being casted from an integer pointer into an unsigned char pointer.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice