--- In [email protected], "David Hamill" <[EMAIL PROTECTED]> wrote: > > Vic wrote: > Therefore you can compute str at runtime, e.g.: > > char *str[100]; /* <-- typo */ > /* compute str here */ > printf(str, i);
Corrected, and using the example in the question:
int i = 123;
char str[100]; /* corrected */
sprintf(str, "%%%di", 5); /* use %% to get % */
printf(str, i);
printf("\nformat used: \"%s\"\n", str);
