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