what is meant by -> ??

This is a discussion on what is meant by -> ?? within the C Programming forums, part of the General Programming Boards category; forgive me for such a n00b question but I have seen this symbol quite alot of times studying data structures ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    13

    what is meant by -> ??

    forgive me for such a n00b question but I have seen this symbol quite alot of times studying data structures n stuff... just didnt find the proper reference anywhere.

    what does " -> " mean ?? can anybody explain me in detail ? or point me in the right direction ?

  2. #2
    Lean Mean Coding Machine KONI's Avatar
    Join Date
    Mar 2007
    Location
    Luxembourg, Europe
    Posts
    444
    If you have a pointer to a structure, then to access its member values, you'd write:
    Code:
    struct something {
    int x;
    }
    
    int main()
    {
    struct something *somePointer;
    // initialize the pointer
    printf("%d", (*somePointer).x);
    }
    Since you have to dereference that pointer each time you want to access "x", the smart guys invented a shortcut, which is somePointer->x !

    Therefore:

    (*pointer).someVariable == pointer->someVariable

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. small -> big -> bigger -> bigger than bigger -> ?
    By happyclown in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 03-11-2009, 01:12 PM
  2. Replies: 8
    Last Post: 05-02-2008, 04:14 AM
  3. Dev-C++ -> Tools - > Editor -> Syntax
    By Yuri2 in forum C++ Programming
    Replies: 19
    Last Post: 07-03-2006, 08:48 AM
  4. > > > Urgent Help < < <
    By CodeCypher in forum C Programming
    Replies: 2
    Last Post: 01-31-2006, 02:06 PM

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