why only the first Iteration workin alright ?
Code:#include <stdio.h> #include <stdlib.h> struct Node { int val; struct Node *next; } ; typedef struct Node Node ; void addNode(Node *head,Node *tail) { Node *current, *temp; char Continue='y'; head=(Node*)malloc(sizeof(Node)); head->val=1; current=head; do { printf("continue?\n"); scanf("%c",&Continue); temp=(Node*)malloc(sizeof(Node)); printf("value=?\n"); scanf("%d",&(temp->val)); current->next=temp; current=current->next; } while(Continue!='n'); } void main() { Node *head=NULL, *tail=NULL; addNode(head,tail); }
TNX



LinkBack URL
About LinkBacks



I used to be an adventurer like you... then I took an arrow to the knee.