/* * Simple *printf positional argument test. * Returns 0 on success and 1 on failure. * Compile: gcc -o testpos testpos.c */ #include #include #include int main(void) { char buffer[256]; sprintf (buffer, "%2$d %3$d %1$d", 1, 2, 3); if (strcmp ("2 3 1", buffer) == 0) { printf("Great, positional arguments seem to work!\r\n"); exit(0); } printf("Uh-oh, positional arguments are broken!\r\n"); exit(1); }