Linked list, no out put,help
- From: asm_fool@xxxxxxxxxxx
- Date: 30 Jun 2006 04:19:30 -0700
dear group,
/*Linked list in C*/
#include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node *next;
}a;
void init(int data)
{
struct node *p;
p = malloc(sizeof *p);
if(!p)
{
printf("mem error");
exit(EXIT_FAILURE);
}
a.data = data;
a.next = NULL;
p = &a;
}
int main(void)
{
unsigned int i,j;
for(j=0;j<6;j++)
{
scanf("%d",&i);
init(i);
}
while(a.next != NULL)
{
for(j=0;j<6;j++)
printf("value = %d\n",a.data);
}
return 0;
}
This is not the first time I am implementing a linked list.But every
time I
try to do that I get no out put. The above is the same situation. The
above
don't print any out put. Can any one tell me why.
[OT]
I can not configure news reader in my company. Same with the mail
reader. Though I use win98 the pop and nntp server simply functioning.
So I go for the ugly google.
[/OT]
.
- Follow-Ups:
- Re: Linked list, no out put,help
- From: D. Power
- Re: Linked list, no out put,help
- From: pete
- Re: Linked list, no out put,help
- From: Alf P. Steinbach
- Re: Linked list, no out put,help
- Prev by Date: Re: Joining 2 char to 1 short
- Next by Date: Re: void vs void* (philosophical question)
- Previous by thread: void vs void* (philosophical question)
- Next by thread: Re: Linked list, no out put,help
- Index(es):
Relevant Pages
|