Hi I have just started out with structures in C.
I have written the following program.I try to read in
a char called c but the program terminates.Can anyone
help me and tell me why.
#include <stdio.h>
typedef struct list
{
int data;
struct list *next;
}ll;
main()
{
ll *head,*p;
int temp;
char c;
head=(ll*) malloc(sizeof(struct list));
printf("the data for head:");
scanf("%d",&head->data);
printf("head=:%d",head->data);
printf("enter the value of c:");
c=getchar();
printf("here:%c",c);
p=head;
system("PAUSE");
return 0;
}
thanks.
__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
|