fork download
  1. #include <stdio.h>
  2. char *my_strcat(char *str_a, char *str_b);
  3.  
  4. char *my_strcat(char *str_a, char *str_b)
  5. {
  6.  
  7. /*まずaの'\0'を見つける*/
  8. while(*str_a){
  9. str_a++;
  10. }
  11.  
  12. /*aの'\0'の位置へbをコピー*/
  13. while(*str_b){
  14. *str_a = *str_b;
  15. str_b++;
  16. str_a++;
  17. }
  18. *str_a = '\0';
  19. return str_a;
  20. }
  21.  
  22.  
  23. int main(void){
  24. char a[800];
  25. char b[800];
  26.  
  27. printf("文字を入力\na:");
  28. scanf("%s",a);
  29. printf("\nb:");
  30. scanf("%s",b);
  31.  
  32.  
  33. printf("\na:%s\t", a);
  34. printf("b:%s\n", b);
  35. my_strcat(a, b);
  36. printf("結果\n%s", a);
  37.  
  38. return 0;
  39. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:28:2: warning: implicit declaration of function ‘scanf_s’ [-Wimplicit-function-declaration]
  scanf_s("%s",a);
  ^
/home/Xey1wS/cc4xVzXU.o: In function `main':
prog.c:(.text.startup+0x31): undefined reference to `scanf_s'
prog.c:(.text.startup+0x4d): undefined reference to `scanf_s'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty