Hello everyone,

I have checked the usage of %n on here
<http://www.cplusplus.com/reference/cstdio/printf/>
and then, I wrote a test program using gcc:
#include <stdio.h>

int main()
{
    int val1, val2;
    printf("Hello%nWorld%n\n", &val1, &val2);
    printf("val1 = %d val2 = %d\n", val1, val2);
    return 0;
}

the execution result:
HelloWorld
val1 = 5 val2 = 10

However, the result is different when I using x86_64-w64-mingw32-gcc
(version  8.1.0 ).
Helloval1 = 0 val2 = 16

I'm confused about these results. Does the result of x86_64-w64-mingw32-gcc
is correct?

Regards,

Gills

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to