I have the following code:
int main(int argc, char *argv[])
{
char ch[10];
printf("String 10 max. :: "); gets( ch );
printf("String: %s\n", ch);
return 0;
}
When I run this with "12345678" as ch it runs well. The strange thing is when I run with "123456789012345678901234567890"! The second printf prints ALL the string (the 30 chars) to the screen.
Why does this happen? Why doesn't my code crash?
Thanks for your time,
Azteca