fork(1) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #define Max 100
  5. void Chu_Dau(char *s);
  6. int main()
  7. {
  8. char ten[Max];
  9. //Nhập tên
  10. printf("Nhap ten: ");
  11. scanf_s("%s", ten);
  12. //Độ dài chuỗi
  13. int n = strlen(ten);
  14. printf("%s", ten[0]);
  15. Chu_Dau(ten);
  16. printf("\n");
  17. system("pause");
  18. return 0;
  19.  
  20.  
  21. }
  22. void Chu_Dau(char *s)
  23. {
  24. int l = strlen(s);
  25. for (int i = 1; i < l; i++)
  26. {
  27. if (s[i] == ' ')
  28. {
  29. if (s[i + 1] == ' ') continue;
  30. else
  31. {
  32. printf("%s ", s[i + 1]);
  33. }
  34. }
  35. }
  36. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:11:2: warning: implicit declaration of function ‘scanf_s’ [-Wimplicit-function-declaration]
  scanf_s("%s", ten);
  ^~~~~~~
prog.c:14:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
  printf("%s", ten[0]);
           ^
prog.c:13:6: warning: unused variable ‘n’ [-Wunused-variable]
  int n = strlen(ten);
      ^
prog.c: In function ‘Chu_Dau’:
prog.c:32:14: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
     printf("%s ", s[i + 1]);
              ^
/home/OgvMdR/cc63pFsh.o: In function `main':
prog.c:(.text.startup+0x20): undefined reference to `scanf_s'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty