DIGIT-ARC read-only archive · snapshot: July 23, 2026

What is purpose of # in C

8 posts · originally from https://geek.digit.in/community/threads/what-is-purpose-of-in-c.87218/

Ecko
Ecko Original post #1
May 6, 2008 at 8:48 PM
We'll guyz I'm sill noob at C & this sem is just over
k just a small ques.
What is the purpose of #
I know its a pre-processor
but if someone can clearly xplain what is is
Xplain in as much lines as u can & i'm ready to read all
Ya I know many of u'll say C suc*s but u know its worth 100 marks here :D
MetalheadGautham
May 6, 2008 at 9:00 PM
the character # when used at the begening of a line tells the compiler to perform the action mentioned in the line before compilation of the code. Hence its called a pre processor. It does stuff to the code like including headder file functions, etc which need to be done BEFORE compiling.
dheeraj_kumar
May 7, 2008 at 7:51 AM
Any line with the # in the beginning is not compiled by the compiler. Thats because those lines are not part of the program, but rather, they contain information ABOUT the program. Thats not the exact way of putting it, but anyway. You can find more information on googling "Preprocessor Directives"
Ecko
Ecko #4
May 10, 2008 at 4:41 PM
Yaar preprocessor directives are the things after #
I wanna ask what # does
Any line with the # in the beginning is not compiled by the compiler.
What # do is tell compiler not to compile it or what ??
Krazy_About_Technology
May 10, 2008 at 7:08 PM
Dude dont get confused. # characters represents the beginning of a preprocessor directive. All preprocessor directives begin with a # and are also pronounced with it. A # directive is a special instruction to the compiler that it had to follow in the process of compiling. # character is used so that compiler can differentiate between a regular word and a preprocessor directive. # character signals the compiler start of a preprocessor directive. I hope its clear to u now :)
dheeraj_kumar
May 10, 2008 at 7:56 PM
See, first the code is checked for any lines beginning with #. If found, the preprocessor processes those lines. PREprocessor. Get it? PRE = BEFORE. So, before compilation, preprocessor is called. Then all the # lines are processed by it. Then all other lines are compiled by the compiler.
QwertyManiac
May 11, 2008 at 6:31 AM
#, as a pre-processor in C is also used to define MACRO assembly directive blocks.

The MACRO and ENDM parts are generated into the compiled program via the use of #.
Ecko
Ecko #8
May 11, 2008 at 8:31 AM
Thanx Guyz
Thanx 4 ur help
I'm clear now...!!! :)