accessing a struct with ->

This is a discussion on accessing a struct with -> within the C++ Programming forums, part of the General Programming Boards category; in some code ive found on the net , i see this method to accessing the struct so it can ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    306

    accessing a struct with ->

    in some code ive found on the net ,
    i see this method to accessing the struct so it can use -> on its members
    IRC *ircs = *((IRC *)param);
    ............................................
    i need someone to explain what the param means in this ,,,

    would this be the same thing ....
    IRC *ircs = new IRC;

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    param is a variable, the parentheses to its left is a cast to a IRC* type, and then param is dereferenced to get the thing pointed to. However, I don't see how the result can be assigned to a variable of type IRC*. Dereferencing a pointer to an IRC type, should give you an IRC type.
    Last edited by 7stud; 04-23-2006 at 03:30 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with linked list sorting function
    By Jaggid1x in forum C Programming
    Replies: 6
    Last Post: 06-02-2009, 02:14 AM
  2. Looking for a way to store listbox data
    By Welder in forum C Programming
    Replies: 20
    Last Post: 11-01-2007, 11:48 PM
  3. newbie needs help with code
    By compudude86 in forum C Programming
    Replies: 6
    Last Post: 07-23-2006, 08:54 PM
  4. accessing member in struct = segmentation
    By subflood in forum C Programming
    Replies: 5
    Last Post: 11-16-2004, 04:47 PM
  5. Bi-Directional Linked Lists
    By Thantos in forum C Programming
    Replies: 6
    Last Post: 12-11-2003, 09:24 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21