code:
char buffer[2]={NULL,NULL};
...// time code and stuff
strftime(buffer, 2, "%M", loctime);
when i print to stdout the buffer i got trash like @, but like this:
char buffer[3]={NULL,NULL,NULL};
...// time code and stuff
strftime(buffer, 3, "%M", loctime);
the buffer is OK, i got minutes, buffer[2] still NULL
My question is, why i need that extra char (buffer[2]) for this works well?
char buffer[2]={NULL,NULL};
...// time code and stuff
strftime(buffer, 2, "%M", loctime);
when i print to stdout the buffer i got trash like @, but like this:
char buffer[3]={NULL,NULL,NULL};
...// time code and stuff
strftime(buffer, 3, "%M", loctime);
the buffer is OK, i got minutes, buffer[2] still NULL
My question is, why i need that extra char (buffer[2]) for this works well?