Obfuscating the Main( )
Consider the C Program given below. The main( ) function is not immediately visible. But we know that every C Program requires a main( ). If you carefully analyze the program you will understand the working of it.
#define _(__,___,____,_____,______,_______) _____##__##____##___
#define NO_MAIN _(a,n,i,m,a,l)
Figure Below Shows the Output
Click here to download the C Program.
The program uses preprocessor directives to hide the main( ). The preprocessor replaces NO_MAIN with the parameterized macro argument named single underscore ( _ ). Remember single underscore is a valid identifier. This macro replaces the letters a,n,i,m,a,l with main using Token Pasting Operator (##). Thus NO_MAIN is replaced with macro argument named single underscore which in turn is replaced with the word main. Also notice that the identifiers inside the macro too are made up of underscore. That made the program even more confusing.
Figure Below Shows the Substitutions Made by the Preprocessor