尝试读取并输出两个数字和一个字符串:
#include <stdio.h>
int main() {
int a;
int b;
char c[100];
printf("please input two integer and one line string within 100 char.\n");
scanf("%d %d %s", &a, &b, c);
printf("%d %d %s\n", a, b, c);
return 0;
}
然后运行:
➜ C ./a.out
please input two integer and one line string within 100 char.
123
23456
helloworld
123 23456 helloworld