Thursday, July 9, 2009

How can i define number in C Programming language?

for example i want to define b as 2 (b=2) and wherever i type b it knows it as 2.

How can i define number in C Programming language?
for this you need macros


it is defined by


#define %26lt;varnam%26gt; %26lt;varvalue%26gt;


note that there is no equal sign and no data type is specified


eg.


#define b 2


does the job


now whereever you write it got replaced by 2 automatically (not in design time (while u coding))


in last plz rank my answer as best if you feel so which encourage me to help more
Reply:#define b 2





I believe.
Reply:for easiness you can use like that-


at the time of declaration of variables you can use


int b=2;


then in whole program the value of b will be taken as 2 by your computer.

pear

No comments:

Post a Comment