【发布时间】:2020-07-27 14:35:51
【问题描述】:
我能做些什么来做到这一点?
#include <stdio.h>
#include <string.h>
void lee(char s[]);
void escribe(char s[]);
int main()
{
char str[20];
char ch;
printf("1 escribe\n2 lee\n");
ch=getchar();
switch(ch) {
case '1':
printf("you are in escribe (write)\n");
lee(str);
break;
case '2':
printf("you are in lee (read)\n");
escribe(str);
break;
default: puts("Error");
}
return 0;
}
void lee(char s[]){
printf("write your sentense\n");
scanf("%[^\n]", s);
}
void escribe(char s[]){
printf("Entered string is %s \n", s);
}
【问题讨论】:
-
定义“不起作用”。发生什么了?应该怎么办?
-
当我去李时,我不会写
-
不要在您的问题中添加各种恐慌的“帮助我 plzzzzz”文本。相反,停下来,深呼吸,然后更详细地解释问题所在。
-
首先我建议你清理你的代码。您的 printf 说了一件事,并且调用的方法位于错误的位置。包括清晰的描述你想要的结果。