编写一个 C 程序以读取输入并将其作为输出打印字符串。例如,我们可以使用 gets 方法读取用户输入,并使用 %s 格式将其作为输出打印字符串。
#include <stdio.h>
int main()
{
char msg[100];
printf("Please enter Any String or Message = ");
gets(msg);
printf("The string that you entered = %s\n", msg);
return 0;
}

此 程序 使用 fgets 函数读取用户输入,并将其作为输出打印该字符串。
#include <stdio.h>
#include <stdlib.h>
int main()
{
char msg[100];
printf("Please enter Any String or Message = ");
fgets(msg, sizeof msg, stdin);
printf("The string that you entered = %s\n", msg);
return 0;
}
Please enter Any String or Message = hello c programmers
The string that you entered = hello c programmers