Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 06-05-2008, 08:48 PM   #1 (permalink)
Wandering In Tecno Land
 
Ecko's Avatar
 
Join Date: Feb 2005
Location: 127.0.0.1
Posts: 724
Lightbulb What is purpose of # in C


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
__________________
Born in Windows Die In Linux © 2009-10 All Rights Reserved.
Learn Linux : www.linoob.com (Official WebSite)
Ecko is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 06-05-2008, 09:00 PM   #2 (permalink)
The Smaller Bang
 
MetalheadGautham's Avatar
 
Join Date: Sep 2007
Location: Gautham City
Posts: 7,490
Default Re: What is purpose of # in C

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.
__________________
http://TheSmallerBang.wordpress.com
eMachines E725 - T4400 2.2GHz, 1GB, 160GB
Nokia 5130XM * T-Sonic 610 2GB
Nokia 2323C * Samsung Galaxy Y
Apple iPad 2 16GB WiFi
MetalheadGautham is online now  
Old 07-05-2008, 07:51 AM   #3 (permalink)
Legen-wait for it-dary!
 
dheeraj_kumar's Avatar
 
Join Date: Dec 2004
Location: Chennai
Posts: 2,471
Default Re: What is purpose of # in C

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"
__________________
If the Start Windows Restart when Windows starts check box is checked Windows Restart will start automatically every time Windows is started. - Actual excerpt from a windows program help file
dheeraj_kumar is offline  
Old 10-05-2008, 04:41 PM   #4 (permalink)
Wandering In Tecno Land
 
Ecko's Avatar
 
Join Date: Feb 2005
Location: 127.0.0.1
Posts: 724
Default Re: What is purpose of # in C

Yaar preprocessor directives are the things after #
I wanna ask what # does
Quote:
Any line with the # in the beginning is not compiled by the compiler.
What # do is tell compiler not to compile it or what ??
__________________
Born in Windows Die In Linux © 2009-10 All Rights Reserved.
Learn Linux : www.linoob.com (Official WebSite)
Ecko is offline  
Old 10-05-2008, 07:08 PM   #5 (permalink)
Alpha Geek
 
Krazy_About_Technology's Avatar
 
Join Date: Jun 2004
Location: Noida - India
Posts: 765
Default Re: What is purpose of # in C

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
__________________
Dell Inspiron 1525 - C2D 2 Ghz, 3GB, 250GB, X3100 :)

Samsung Omnia Pro B7610 with Stock WM 6.1 ROM

Blog: http://www.sumitbhardwaj.co.in/blog
Krazy_About_Technology is offline  
Old 10-05-2008, 07:56 PM   #6 (permalink)
Legen-wait for it-dary!
 
dheeraj_kumar's Avatar
 
Join Date: Dec 2004
Location: Chennai
Posts: 2,471
Default Re: What is purpose of # in C

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.
__________________
If the Start Windows Restart when Windows starts check box is checked Windows Restart will start automatically every time Windows is started. - Actual excerpt from a windows program help file
dheeraj_kumar is offline  
Old 11-05-2008, 06:31 AM   #7 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default Re: What is purpose of # in C

#, 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 #.
__________________
Harsh J
www.harshj.com
QwertyManiac is offline  
Old 11-05-2008, 08:31 AM   #8 (permalink)
Wandering In Tecno Land
 
Ecko's Avatar
 
Join Date: Feb 2005
Location: 127.0.0.1
Posts: 724
Default Re: What is purpose of # in C

Thanx Guyz
Thanx 4 ur help
I'm clear now...!!!
__________________
Born in Windows Die In Linux © 2009-10 All Rights Reserved.
Learn Linux : www.linoob.com (Official WebSite)
Ecko is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
purpose of town.mid in vista ? anandk Software Q&A 3 07-04-2009 10:01 PM
What is the purpose of Card Reader? ajayritik QnA (read only) 1 05-11-2007 05:36 PM
Any free Software for the purpose kumarn_2004 Software Q&A 3 09-08-2007 11:13 AM
Needed sites...for these purpose. Quiz_Master QnA (read only) 5 14-06-2007 09:20 PM
Looking for Config. for Graphics Purpose idisappear QnA (read only) 43 08-10-2004 11:39 PM

 
Latest Threads
- by Sujeet
- by clmlbx
- by Sujeet
- by icebags

Advertisement




All times are GMT +5.5. The time now is 10:59 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2