fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. char str;
  5. char ch;
  6.  
  7. printf("请输入一个字符串: ");
  8. scanf("%s", str);
  9.  
  10. printf("请输入一个字符: ");
  11. scanf(" %c", &ch);
  12.  
  13. printf("\n--- 输出结果 ---\n");
  14. printf("你输入的字符串是: %s\n", str);
  15. printf("你输入的字符是: %c\n", ch);
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0.01s 5316KB
stdin
Hello
A
stdout
请输入一个字符串: 请输入一个字符: 
--- 输出结果 ---
你输入的字符串是: (null)
你输入的字符是: H