Well, I've a weird problem with printf()
. It's outputting garbage on the screen. It's kind of connected with memory, I guess. Have a look:
char string1[] = "SAMPLE STRING";
char string2[20]; // Some garbage in it
/* Let's clear this madness*/
int i = 0;
for (i; i < 20; i++) string2[i] = ' '; // Space, why not?
printf("output: %s", string2);
Output
output: ╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠SAMPLE STRING
// Ten spaces and random characters, why?