#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0

    Help please "error, request for member ‘out’ in something not a structure or union "


    Hello

    if anyone can help me with this error in the last two lines of the "makeEdgeBetween2Nodes " function:
    error is " request for member ‘out’ in something not a structure or union

    Code:
    typedef st_graphNode ;
    typedef struct st_edgeList 
    {
    double val;
    struct st_edgeList *next;
    //struct st_edgeList *previous;
    struct st_graphNode *node;
    }t_edgeList ;
    
    typedef struct st_graphNode 
    {
    int val;
    int additional ;
    struct st_graphNode *next;
    //struct st_graphNode *previous;
    t_edgeList *out;
    }t_graphNode;
    
    void makeEdgeBetween2Nodes(t_graphNode **node1,t_graphNode **node2 , t_edgeList **e)
    {
    inserEdge(&(*node1),&(*e));
    inserEdge(node2,e);
    
    ((node1)->out)->node=node2;
    ((node2)->out)->node=node1; 
    }
  2. #2
  3. Wiser? Not exactly.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    5,905
    Rep Power
    3969
    node1 and node2 are pointers to a pointer, but you are using them as if they were points to a struct.

    Perhaps you intended to write:
    Code:
    ((*node1)->out)->node=node2;
    ((*node2)->out)->node=node1;
    Recycle your old CD's, don't just trash them



    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0
    yes you are right . the error disappeared :) ,,,,, thaaanks
    can you explain to me how to use pointer to pointer ?. for example in the main function , how could I call the function "makeEdgeBetween2Nodes" .
  6. #4
  7. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,364
    Rep Power
    1870
    Another cross-poster getting the same answer in several places, thus wasting at least one persons time.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper

IMN logo majestic logo threadwatch logo seochat tools logo