What is "->" in C programming language?

This is a discussion on What is "->" in C programming language? within the C Programming forums, part of the General Programming Boards category; As per title, sorry for the newbie question, i can't find the explaination anywhere... thank you in advance!...

  1. #1
    Registered User
    Join Date
    Dec 2012
    Posts
    17

    What is "->" in C programming language?

    As per title, sorry for the newbie question, i can't find the explaination anywhere... thank you in advance!

  2. #2
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,657
    It's a member access operator for pointer variables.

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Access member of a struct via a pointer.

    So if p is a pointer to an instance of some struct type, and m is a member of that struct type, then p->m accesses the member m of the structure pointed to by p. It is syntactically equivalent to (*p).m
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  4. #4
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,311
    Read about this operator, and the rest of them, here:
    Operators in C and C++ - Wikipedia, the free encyclopedia
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. "the C programming language" by K&R ?
    By vmars316 in forum C Programming
    Replies: 2
    Last Post: 02-22-2012, 10:28 AM
  2. Replies: 4
    Last Post: 11-19-2011, 07:57 PM
  3. Question on the book "C Programming Language" by K&R
    By noahian in forum C Programming
    Replies: 3
    Last Post: 09-04-2011, 03:56 PM
  4. Doubt in "C Programming Language by K & R"
    By ackr1201 in forum C Programming
    Replies: 5
    Last Post: 07-12-2011, 11:34 AM
  5. Question about the book "The C Programming Language"
    By caduardo21 in forum C Programming
    Replies: 4
    Last Post: 05-15-2005, 02:22 PM

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