mis.c:24: error: request for member ‘vertex’ in something not a structure or union

This is a discussion on mis.c:24: error: request for member ‘vertex’ in something not a structure or union within the C Programming forums, part of the General Programming Boards category; mis.c:24: error: request for member ‘vertex’ in something not a structure or union ammm....the problem? thanks.... Code: typedef struct node{ ...

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    230

    mis.c:24: error: request for member ‘vertex’ in something not a structure or union

    mis.c:24: error: request for member ‘vertex’ in something not a structure or union


    ammm....the problem? thanks....
    Code:
    typedef struct node{
    	int vertex;
    	struct node *next;
    }ListNode;
    
    ListNode *search_and_insert(ListNode *front, int v){
    	ListNode *temp;
    	ListNode *final;
    	temp=front;
    
    		while(temp!=NULL){
    		if(temp->vertex==v){
    			return NULL;
    		}
    			temp=temp->next;
    			if(temp->next == NULL){
    				final = temp;
    			}
    		}
    		
    		final.vertex = v;
    		front = final;
    return front;
    }

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,451
    final isn't a struct, it's a pointer, so you need to use the -> accessor.

  3. #3
    Registered User
    Join Date
    Aug 2010
    Posts
    230
    thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 05-18-2010, 04:14 AM
  2. Problem Passing Structure Reference To Function
    By soj0mq3 in forum C Programming
    Replies: 9
    Last Post: 04-24-2010, 10:27 AM
  3. union inside structure
    By vijay s in forum C Programming
    Replies: 1
    Last Post: 12-03-2009, 06:21 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Structure containing a union of more structures!
    By Bajanine in forum Windows Programming
    Replies: 2
    Last Post: 03-08-2003, 10:53 AM

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