Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Language

C

Compiler

gcc HEAD 11.0.1 20210414 (experimental)

Options
Warnings
C11(GNU)
no pedantic

$ gcc prog.c -Wall -Wextra -std=gnu11
prog.c: In function 'output_strings_reverse':
prog.c:14:14: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'int' [-Wformat=]
   14 |     printf("%s\n", *array_p[i]);
      |             ~^     ~~~~~~~~~~~
      |              |     |
      |              |     int
      |              char *
      |             %d
prog.c: In function 'main':
prog.c:34:13: warning: assignment to 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
   34 |   *str_p[i] = (char *)malloc(strlen(data) + 1);
      |             ^
prog.c:35:10: warning: passing argument 1 of 'strcpy' makes pointer from integer without a cast [-Wint-conversion]
   35 |   strcpy(*str_p[i], data);
      |          ^~~~~~~~~
      |          |
      |          char
In file included from prog.c:3:
/usr/include/string.h:125:39: note: expected 'char * restrict' but argument is of type 'char'
  125 | extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
      |                      ~~~~~~~~~~~~~~~~~^~~~~~
prog.c:41:26: warning: passing argument 1 of 'output_strings_reverse' from incompatible pointer type [-Wincompatible-pointer-types]
   41 |   output_strings_reverse(&str_p, i);
      |                          ^~~~~~
      |                          |
      |                          char * (*)[20]
prog.c:9:36: note: expected 'char **' but argument is of type 'char * (*)[20]'
    9 | void output_strings_reverse(char **array_p, int m)
      |                             ~~~~~~~^~~~~~~
prog.c:22:7: warning: unused variable 'n' [-Wunused-variable]
   22 |   int n;  //文字列の個数
      |       ^
Signal:
Segmentation fault