c - Printing the value of a 0-initialized array element prints nothing, why? -
i have initialize char array 0's. did like
char array[256] = {0}; i wanted check if worked tried testing it
#include <stdio.h> int main() { char s[256] = {0}; printf("%c\n", s[10]); return 0; } after compile , run it, command line output shows nothing.
what missing ? perhaps initialized array in wrong manner ?
tl;dr -- %c character representation. use %d see decimal 0 value.
related , c11, chapter §7.21.6.1, (emphasis mine)
cif nollength modifier present,intargument convertedunsigned char, and resulting character written.
fyi, see list of printable values.
that said, hosted environment, int main() should int main(void), @ least conform standard.
Comments
Post a Comment