Thread: error: list has no member named list

  1. #1
    Registered User
    Join Date
    Mar 2018
    Posts
    2

    Post error: list has no member named list

    please help me with this

    Code:
    #include<stdio.h>
    #include<conio.h>
    
    
    struct node
    {
        int info;
        struct node *link;
    };
    typedef struct node list;
    list *first=NULL;
    
    
    void insertb(int);
    void deleteb();
    void traverse();
    
    
    void main()
    {
        int ch,x;
        clrscr();
    
    
        while(1)
        {
            printf("\nLINK LIST OPERATIONS: ");
            printf("\n1. INSERTION AT BEGINNING");
            printf("\n2. DELETION AT BEGINNING");
            printf("\n3. TRAVERSE");
            printf("\n4. EXIT");
    
    
            printf("\nEnter your choice : ");
            scanf("%d",&ch);
    
    
            switch(ch)
            {
                case 1:
                    printf("\nEnter value to be inserted : ");
                    scanf("%d",&x);
                    insertb(x);
                    break;
                case 2:
                    deleteb();
                    break;
                case 3:
                    traverse();
                    break;
                case 4:
                    exit(0);
                default:
                    printf("->PLEASE ENTER CORRECT CHOICE");
            }
        }
    }
    
    
    void insertb(int x)
    {
        list *newn;
    
    
        newn=(list*)malloc(sizeof(list));
        newn->info=x;
        newn->list = first;
        first=newn;
    }
    
    
    void deleteb()
    {
        int x;
    
    
        list *temp;
        if( first == NULL)
        {
            printf("\nLIST IS EMPTY ");
        }
    
    
        else
        {
            temp = first;
            x = temp->info;
            first = first->link;
            printf("\ndeleted element is %d ",x);
            free(temp);
        }
    }
    
    
    void traverse()
    {
        list *temp;
    
    
        if(first ==  NULL)
        {
            printf("\nLIST IS EMPTY");
        }
        else
        {
            temp=first;
            printf("\nlist elements are : ");
            while(temp!=NULL)
            {
                printf("\n%",temp->info);
                temp=temp->link;
            }
        }
    }
    output is on the attachment
    Attached Images Attached Images error: list has no member named list-whatsapp-image-2018-03-15-6-19-51-pm-jpg 
    Last edited by thisisabhi; 03-15-2018 at 11:51 AM.

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    list and link are different words.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I was going to say something about void main, but then I saw the screen shot of TurbidC.

    Dude, that was obsolete 30 years ago.

    Who keeps teaching this mind-rot?
    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.

  4. #4
    Registered User
    Join Date
    Mar 2018
    Posts
    2
    Incredible India

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I guess one question to ask your tutor is how learning about 30 year old 16-bit technology prepares you for a 64-bit world.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. error: 'struct SPPS48' has no member named 'M1'
    By uzmeed in forum C++ Programming
    Replies: 1
    Last Post: 01-04-2018, 04:14 PM
  2. 'std::string' has no member named 'get' list[i]=user.get;
    By QuinnSF in forum C++ Programming
    Replies: 3
    Last Post: 04-26-2014, 05:56 AM
  3. Error: structure XX has no member named YY
    By limp in forum C Programming
    Replies: 2
    Last Post: 04-07-2011, 04:52 PM
  4. Error: no member named 'whatever'
    By vileoxidation in forum C++ Programming
    Replies: 31
    Last Post: 10-09-2009, 08:12 PM
  5. Replies: 1
    Last Post: 04-17-2008, 07:45 PM

Tags for this Thread