I came across a program that prints itself on this site, i.e. it prints the program code.
The program code is:
#include
char *program
char *program = "#include %cchar *program = %c%s%c;%cint main()%c{%cprintf(program, 10, 34, program, 34, 10, 10, 10, 10, 10, 10);%c return 0;%c}%c";
There is a char pointer name "program" which is used to store the string and %c and %s are format specifiers for char and string arguments respectively.
printf(program, 10, 34, program, 34, 10, 10, 10, 10, 10, 10);
printf function is printing output to console, 10 here is ASCII code for NEWLINE and 34 for " printf parameters are doing