...
In this noncompliant code example, the programmer is attempting to overwrite the format string with a string value read in from stdin such as "%d%f 1 3.3" , and to use the resulting modified string of "%s%d%f" to input the subsequent %d and %f values:
Code Block | ||||
---|---|---|---|---|
| ||||
#include <stdio.h> /* ... */ char format[100] = "%s"; int i; float x; int n = scanf(format, format + 2, &i, &x); |
...