Download CS240 Programming in C

Transcript
Common Mistakes: Not enough space


Not enough space. s needs to include ‘\0’ at
the end of the string. “Hello\0” takes 6 chars
and not 5.
char s[5];
strcpy(s,"Hello");
Fix:
char s[6];
strcpy(s,"Hello");
Related documents