#include
Typedef struct LNode
{char data;
struct LNode *next;
} LinkNode;
Char a, [50].
Void CreateList (LinkNode * & amp; L, char [], int n)
{LinkNode * s * r;
int i;
L=(LinkNode *) malloc (sizeof (LinkNode));
L - & gt; next=NULL;
R=L;
for(i=0; i
S - & gt; data=https://bbs.csdn.net/topics/a [I];
R - & gt; Next=s;
r=s;
}
R - & gt; next=NULL;
}
Void ReadList (LinkNode * & amp; L, char x)
{
LinkNode * p=L;
Int j=0;
While (p!=NULL) {
If (p - & gt; data=https://bbs.csdn.net/topics/=x)
j++;
P=p - & gt; next;
}
Printf (" % d ", j);
}
Int main ()
{
LinkNode * L;
int i,n;
Char x;
The scanf (" % c % d ", & amp; X, & amp; N);
for(i=0; i
Printf (" % c ", a [0]).
CreateList (L, a, n);
ReadList (L, x);
return 0;
}
CodePudding user response:
Main function:The scanf (" % c % d ", & amp; X, & amp; N);//after execution, the keyboard buffer inside still enter symbols, behind the scanf % c will return to enter
getchar ();//filter the carriage return, or use fflush (stdin); Can also be
for(i=0; i
Void ReadList (LinkNode * & amp; L, char x)
{
LinkNode * p= L - & gt; Next ;//want to change, L is short, next is the first effective
CodePudding user response:
Fun