My question is about the behavior after a printf with a missing argument:
printf("%s blah blah %d", int); // integer was given as argument (and not int written)
I already know that if there are insufficient arguments for the format, the behavior is
undefined.
The question is whether it is undefined for the printf outcome or for the whole program?
- A crash can happen when %s tried to read from unauthorized memory address. (it happened to me)
- Can a crash happen [long] after the printf complete? (printed some garbage string and an integer)
Edit:
To clarify I'm not asking about compilation errors or warnings, nor can a program crash when executing this line. The question is can this line make the program crash randomly after this line already executed.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…