Why is this output?

Here is the Code of:

# include <stdio.h> 
# define scanf  "%s Geeks For Geeks " 
main() 
{ 
    printf(scanf, scanf); 
    getchar(); 
    return 0; 
}

Output is:%s Geeks For Geeks Geeks For Geeks

How is this output generated?


your printf will become

printf(scanf, scanf);

         |
         |
        \ /

printf("%s Geeks For Geeks ", "%s Geeks For Geeks" ); 

         |
         |       //%s is replaced with "%s Geeks For Geeks" string
        \ /

printf("%s Geeks For Geeks Geeks For Geeks ");

and on the console

%s Geeks For Geeks Geeks For Geeks

Aside: Please don't do this kind of coding. It sucks.