help needed here

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dasarisrikar
    New Member
    • Sep 2006
    • 18

    help needed here

    hello..can anybody help me..
    i cant understood the meaning of *(int *)p=2;
    so pls hepl me...wt it actully do....
  • dasarisrikar
    New Member
    • Sep 2006
    • 18

    #2
    help needed here

    pls explain....*(in t *)p=2;

    Comment

    • srikar
      New Member
      • Sep 2006
      • 62

      #3
      It means typecasting the variable to (int*) and assigning the value to pointer P

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Here is a pointer tutorial

        Comment

        • Banfa
          Recognized Expert Expert
          • Feb 2006
          • 9067

          #5
          I have to assume p is a pointer or contains the value of a pointer

          so

          (int *)p

          casts p to be a pointer to an integer

          *(int *)p

          dereferences the pointer that is (int *)p, i.e. accesses the memory location referenced by (int *)p

          *(int *)p = 2;

          Sets the value of the memory location pointed to by the pointer (int *)p to 2


          oh and please don't double post

          Comment

          Working...