/* * program demonstrating what %n does */ #include #include /* * here's the main program -- simple */ int main(int argc, char *argv[]) { int c1, c2; /* where to store the counts */ /* use %n to store numbers of chars printed */ printf("The number of bytes written up to this point X%n is being stored in, " "c1, and the number of bytes up to here X%n is being stored in c2.\n", &c1, &c2); /* announce it */ printf("c1: %d\n", c1); printf("c2: %d\n", c2); /* all done! */ return 0; }