What's with this -> operator?

This is a discussion on What's with this -> operator? within the C Programming forums, part of the General Programming Boards category; Seen quite a bit of code example with -> in them, like this *hostEntry->h_addr_list but what's this -> as it ...

  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    11

    What's with this -> operator?

    Seen quite a bit of code example with -> in them, like this

    *hostEntry->h_addr_list

    but what's this -> as it does not seem to be mentioned in the various tutorials I've been learning from


    Thanks

    dicky

  2. #2
    Registered User
    Join Date
    Jun 2003
    Location
    Austria
    Posts
    55
    you can access the elements of a struct with this "->" operater, if there is just a pointer to the struct.

  3. #3
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    Look at the section explaining the -> operator.
    http://www.iota-six.co.uk/c/h3_structs_part_2.asp
    Help populate a c/c++ help irc channel
    server: irc://irc.efnet.net
    channel: #c

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Registered User
    Join Date
    Jul 2004
    Posts
    15

    there u go

    in addition to what iceball said it can also be used to access objects of a class using a pointer.

  6. #6
    Registered User
    Join Date
    Aug 2001
    Posts
    247
    alvarorahul says...
    in addition to what iceball said it can also be used to access objects of a class using a pointer.
    Only as stated with a pointer to an instance (object) of the class.
    Besides that is C++ and this is the C message board.
    hoping to be certified (programming in c)
    here's the news - I'm officially certified.

  7. #7
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    How could you forget unions?

    Quzah.
    Hope is the first step on the road to disappointment.

  8. #8
    ---
    Join Date
    May 2004
    Posts
    1,379
    Quote Originally Posted by quzah
    How could you forget unions?

    Quzah.
    quite easily

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Smart pointer class
    By Elysia in forum C++ Programming
    Replies: 63
    Last Post: 11-03-2007, 07:05 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Overloading -> operator
    By Hunter2 in forum C++ Programming
    Replies: 0
    Last Post: 05-10-2004, 03:08 PM
  4. operator overloading and dynamic memory program
    By jlmac2001 in forum C++ Programming
    Replies: 3
    Last Post: 04-06-2003, 11:51 PM
  5. -> operator and its uses and benefits
    By supaben34 in forum C++ Programming
    Replies: 3
    Last Post: 11-04-2002, 02:56 AM

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