Why is it that the following:
#include <stdio.h>
int main(int argc, char *argv[])
{
char array[3] = {'1', '2', '3'};
printf("%s\n", array);
return 0;
}
produces 1238À§Wˇ
("123" + some random chars) as expected, while the same code with:
int main(void)
instead of argc
, argv
produces: 123
(despite there being no room for the null byte).
How is it that the lack of room for a null byte in array
with void
doesn't seem to matter?