memset zero 2d array big ISO warning ... how to rid of it?
every sense I just put
gcc -Wall -Wextra -Wpedantic -lm -o "%e" "%f"
in my line I get this now.
Code:
gcc -Wall -Wextra -Wpedantic -lm -o "find_the_spywords" "find_the_spywords.c" (in directory: /home/userx/bin)
find_the_spywords.c: In function 'main':
find_the_spywords.c:62:4: warning: ISO C forbids zero-size array [-Wpedantic]
memset(keyword, 0, 10 * 50 * sizeof(char[0][0]));
^
find_the_spywords.c:62:4: warning: ISO C forbids zero-size array [-Wpedantic]
find_the_spywords.c:85:2: warning: ISO C forbids zero-size array [-Wpedantic]
memset(spywords, 0, 10 * 50 * sizeof(char[0][0]));
^
find_the_spywords.c:85:2: warning: ISO C forbids zero-size array [-Wpedantic]
Compilation finished successfully.
so what is the real way to properly zero a 2d char array , or any 2d array for that matter?
Code:
char spywords[10][50];
memset(spywords, 0, 10 * 50 * sizeof(char[0][0]));