Thread: what is meant by -> ??

  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, 12:12 PM
  2. Replies: 8
    Last Post: 05-02-2008, 03:14 AM
  3. Dev-C++ -> Tools - > Editor -> Syntax
    By Yuri2 in forum C++ Programming
    Replies: 19
    Last Post: 07-03-2006, 07:48 AM
  4. > > > Urgent Help < < <
    By CodeCypher in forum C Programming
    Replies: 2
    Last Post: 01-31-2006, 02:06 PM