我的 link 列表输出不正确?

my output of link list is not correct?

1[In my link list program I have a problem in output.when second time the compiler ask my choice then its not accept my choice directly output is appears where the problem I can't get it.]2

记得在输入上一个 scanf 的数据后按 Enter 吗?此换行符由 scanf%c.

使用

你必须改变

scanf("%c",&ch);
fflush(stdin);

scanf(" %c", &ch);

这样 scanf 将跳过前一个 scanf 留下的换行符。 %c之前的space是一个白色space字符,scanf的格式字符串中的白色space字符告诉scanf扫描并丢弃任何白色space字符的数量,如果有的话,直到第一个非白色space字符。

并且 fflush(stdin); 根据 C 标准未定义,尽管一些实现定义了它的行为。基本上,您应该避免它以增加可移植性。