Thread: error:expected declaration or statement at end of input

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    63

    linked list and read strings-problem

    GO TO POST 6(is my new problem)
    {
    this solved
    I am getting this message when i am trying to compile the code
    series1.c:44: σφάλμα: expected declaration or statement at end of input
    series1.c:44: σφάλμα: expected declaration or statement at end of input
    where is the mistake?(maybe any missing { or })


    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    struct node{
      char data[64];
      struct node *next;
     };
    struct node *firsta, *currenta, *newa;
    
    int main(void)
    {
     int k;
     scanf("%d", &k);
    
     struct node *head=NULL;
    
     do{
      switch(k){
       case 1: addnew();
       break;
    
      }while(k!=0);
    
     void addnew(void)
    {
     struct node *newnode=malloc(sizeof(struct node));
      
     if (head=NULL) 
      firsta=newa=currenta;
     else
     {
      currenta=firsta;
       while(currenta->next!=NULL)
        currenta=currenta->next;
    
       currenta->next=newa;
       currenta=newa;
    }
    
    gets(currenta->data);
    
    currenta->next=NULL;
    }
    }SOLVED
    Last edited by alzar; 09-20-2007 at 12:23 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Parse error at end of input??
    By erikcn in forum C++ Programming
    Replies: 4
    Last Post: 06-05-2002, 09:41 AM
  2. Parse Error At End Of Input?!?!?!?!?!
    By kas2002 in forum C++ Programming
    Replies: 3
    Last Post: 06-02-2002, 09:22 AM
  3. Replies: 2
    Last Post: 05-10-2002, 04:16 PM
  4. Uh-oh! I am having a major switch problem!
    By goodn in forum C Programming
    Replies: 4
    Last Post: 11-01-2001, 04:49 PM
  5. Reading integers until end of input
    By nivo in forum C Programming
    Replies: 7
    Last Post: 10-20-2001, 04:18 PM