Newer
Older
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wformat-truncation"
#endif
int
main (void)
{
char string[8 + 1];
printf ("The following string should be 10 digits long\n");
snprintf (string, sizeof(string), "1234567890");
printf ("%s\n", string);
printf ("But it's only 8, which is one fewer than the char array length\n");
return 0;
}