嘗試讀取并輸出兩個數字和一個字符串:
#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