1 2 3 4 5 6 7 8 9 10 11 12 13 14
char buf[40]; extern int sprintf (char*, const char*, ...); extern void abort (void); int main() { int i = 0; int l = sprintf (buf, "%s", i++ ? "string" : "other string"); if (l != sizeof ("other string") - 1 || i != 1) abort (); return 0; }