Thread: What is this?

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    17

    What is this?

    if(strcmp(dumn, temp.) data) == 0)
    count++;
    temp = temp->next;

    what is the "->" used for?

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,912
    If you have a pointer to a class or struct/union, that is the operator. like:

    struct mystruct
    {
    .....
    }

    mystruct myinstance
    mystruct *mypointer = &myinstance

    then you use mypinter->something in the structure.

    It's just like :: or ., but for a different scope - indirection.

  3. #3
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    It is a shortcut for:

    (*pointer).pointer_function_or_variable

Popular pages Recent additions subscribe to a feed