473,385 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

what is # symbol in C?

2
what is the function of # symbol in C.
for eg:# include<stdio.h>.this statement is used for linking the i/p nd o/p fns in the pgm to the header file.is this # is the directive.somebody said to me that # is assembler directive.can anyone explain what an assembler directive is?
Jul 17 '07 #1
4 1698
JosAH
11,448 Expert 8TB
what is the function of # symbol in C.
for eg:# include<stdio.h>.this statement is used for linking the i/p nd o/p fns in the pgm to the header file.is this # is the directive.somebody said to me that # is assembler directive.can anyone explain what an assembler directive is?
The '#' introduces a so called 'pp-token', i.e. a 'preprocessor token'. It has nothing
to do with assembly or whatever. Within a preprocessor directive this character
may be the catenation operator or the stringize operator. It's all preprocessor
stuff which by itself has nothing to do with the C(++) language itself.

kind regards,

Jos

ps. what is "i/p nd o/p fns"?
Jul 17 '07 #2
scruggsy
147 100+
The '#' introduces a so called 'pp-token', i.e. a 'preprocessor token'. It has nothing
to do with assembly or whatever. Within a preprocessor directive this character
may be the catenation operator or the stringize operator. It's all preprocessor
stuff which by itself has nothing to do with the C(++) language itself.

kind regards,

Jos

ps. what is "i/p nd o/p fns"?
I think that translates to "i/o functions".

To clarify a little bit on what Jos said, preprocessor directives are a way of communicating with the compiler while it's building your code. Like telling it what other source files to include, or defining macros (text substitution), or telling it to ignore parts of the code under certain conditions. They are not part of the C++ language.
Jul 17 '07 #3
tburger
58
Outside of indicating which source files / libraries to include, the "#" character can also be used to define a "global constant"...

example:

#define PI 3.145

Anywhere you use "PI" in your code, the compiler will replace it with the value 3.145.

It's another way to set a constant in C. It becomes quite handy when "PI" comes up in your code many times. Instead of having to find and replace 10 "PI" values, all you have to do is change the #define value and the compiler will do it for you...

Enjoy

Tom
Jul 17 '07 #4
epyk
7
ive know # as a compiler directive, it allows you to use the compiler to edit, add or select code during compile time. you can prolly find documentation on whatever compiler you are using
Jul 20 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Troll | last post by:
Hi, This is related to my previous post but I made it much simpler... open (INFILE, "test.txt"); while (<>) { print $_; s/one/two/g; print $_; }
0
by: Richard | last post by:
I am setting up HS in 8i, when I go to $ORACLE_HOME/bin and do a ldd hsodbc i get the below error message, I have done a relink to recreate the hsodbc executable but still no luck. I do have a tar...
0
by: John Graat | last post by:
Hi all, I've built the STLport-462 library on AIX-4.3.3 using gcc-3.3.2. No errors during compilation. However, during linking the following error occurs: ld: 0711-317 ERROR: Undefined symbol:...
9
by: Prasad | last post by:
HI, I am a beginner in VC++.. I am trying to write a Win32 console application in visual studio.. I am using following header files.. #include <STRING> using namespace std; #include...
2
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include...
1
by: vsp15584 | last post by:
Hii..i use the coding as below :- import java.applet.applet; import java.awt.*; import com.sun.j3d.utils.applet.mainframe; import com.sun.j3d.utils.universe.*; import...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
1
by: yamitmehta | last post by:
When I compile to code using g++arm of VxWorks 5.5 and put it on my board i get the follwing undefined symbols:- Cpool and Csingleton are template classes. CPool has the static member...
2
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double)...
3
by: Sindhu Rani | last post by:
i hav created 3 classes in 3 different files. am gettin an error durin compilation. wat shud i do??? C:\s\source>javac -d ..\classes devtestdrive.java devtestdrive.java:5: cannot resolve symbol...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.