On Habre says :
The qualifier "% n" does not take into account the number of characters derived from specifiers such as "% f". Therefore, we put one space before "% n" to write the value 1 to isOkPassword.
However, the verification shows that this is not the case at all:
#include <stdio.h> int main(void) { int n; printf("%f %n\n", 12.0, &n); printf("%d", n); return 0; } 12.000000 10 And how should this code actually work?
Like %n for this purpose, it is necessary to take into account the formats, because otherwise there would be no point in it.
printfis in both languages. - Qwertiy ♦%fformat (I suppose other formats are also implied). And this is a blog of Pvs Studio - a code analyzer - it’s somehow strange that they shouldn’t be trusted :( - Qwertiy ♦