function Pointer

Discussion in 'C' started by ventiz, Aug 20, 2008.

  1. ventiz

    ventiz New Member

    Joined:
    Aug 20, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hello I'm new in C/C++ and I don't why the following structure has a pointer in the function name.

    struct node *pop(struct node *p, int *value)
    {
    struct node *temp;
    if(p==NULL)
    {
    printf(" The stack is empty can not pop Error\n");
    exit(0);
    }
    *value = p->data;
    temp = p;
    p = p->link;
    free(temp);
    return(p);
    }


    Can someone can tell me why the pop function has a pointer.
    Thank you,
    Enjoy your life
     
  2. aditiya

    aditiya New Member

    Joined:
    Aug 21, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Bcoz Fuction Pop is returning a pointer of type struct node
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice