Home > Back-end >  A short answer the list of questions about the structure of the pointer is very mess
A short answer the list of questions about the structure of the pointer is very mess

Time:02-07

Int main () {
Char c, a, [100].
Int I=0, j, k;
Head LNode * and * node;
Head=(LNode *) malloc (sizeof (LNode));
The head=NULL;
While ((c=getchar ())! )
='\ n'{
A [I]=c;
i++;
}

for(j=0; j{
The node=(LNode *) malloc (sizeof (LNode));
Node - & gt; Val=a, [j].
Node - & gt; Next=head;
The head=node;
}
While (the head - & gt; Next!=NULL)
{
CoutThe head=head - & gt; next;
}
return 0;
}

Why not I input the number of output

CodePudding user response:

C and C + + intertwined, looking at not tired?
Such as: the head=(LNode *) malloc (sizeof (LNode));
If C, casts do? And the error is not easy to find, head=malloc (sizeof (LNode)); Seems to be better, don't gild the lily,
If c + +, new line, directly calls the constructor directly,,,
  • Related