I need to move first symbol to the end by using lists. It should be moved to the end and deleted from the beggining. I am a begginer, so its is difficult to me. Thanks for help. Here is my code, I dont know what more shall I do...
#include <stdio.h>
#include <stdlib.h>
struct L
{
int symbol;
struct L *next;
};
typedef struct L List;
typedef List *ListPtr;
int main ()
{
int nr=0,i;
char a;
ListPtr lst ;
lst=(ListPtr) malloc(sizeof(List));
ListPtr start=lst;
printf("Enter list symbols (ctrl+z the end:\n");
scanf("%c",&(lst->symbol));
a=lst->symbol;
while (!feof(stdin))
{
lst->next=(ListPtr) malloc(sizeof(List));
lst=lst->next;
scanf("%c",&(lst->symbol));
nr++;
}
lst->next=(ListPtr) malloc(sizeof(List));
lst=lst->next;
lst->symbol=a;
lst->next=NULL;
lst=start;
printf("The list is:\n");
for (i=0; i<=nr; i++)
{
printf("%c",lst->symbol);
lst=lst->next;
}
printf("\n");
lst=start;
system("pause");
return 0;
}