If the user inputs 1 the program will automatically create a new node..How? the maximum that I can do is 2..how to add node?
Code blocks are created by indenting at least 4 spaces
... and can span multiple lines
def *New(def *pHead){
def *temp;
temp = malloc(sizeof(def));
pHead->pNext = temp;
temp->pNext = NULL;
return temp;
}
void plusdata( def *pHead){
char D;
int s,r;
def *pNew, *current;
int count=0,i=0;
do{
printf("Allocate:");
scanf("%d,%c",&r,&D);
if((r == 1)){
pNew = New(pHead);
}
if(pNew->pNext == NULL)
printf("Nulling success!\n");
pHead->access.count = 4;
pNew->access.count = 2;
current = pHead;
while (current != NULL){
count++;
printf("%d: %d\n",count,current->access.count);
current = current->pNext;
}
pNew -> pNext = pHead;
printf("Count: %d\n",count);
printf("again:");
scanf("%d",&s);
count=0;
}while(s == 1);