Explain the #define directive, C/C++ Programming

Assignment Help:

The #define Directive

The #define directive explains a macro which is a text string represented by a name. Whenever the pre-processor finds this name in the program, it is replaced by the text string it shows. The is an following example which explains a value and gives it a name PI.

                #define PI 3.14285    // no semicolon given

                void main()

                 {

                                cout << PI;

                 }

This program is equivalent to :

                void main()

                 {

                                cout << 3.14285;

                 }

The  # define directive works strictly on the basis of substitution of a text string for the macro names.

 


Related Discussions:- Explain the #define directive

Constructor, Why copy constructor accepts reference to an object and not t...

Why copy constructor accepts reference to an object and not the object itself, whether ah hence it we do otherwise

Question, wap to calculatethe volume of cone,cylinderand sphere

wap to calculatethe volume of cone,cylinderand sphere

Memory allocation for objects, when a class is defined the compiler will no...

when a class is defined the compiler will not allocate memory. This is true only for data member not for member function.  As soon as the member function is defined  the require

C , why c is middle level language?

why c is middle level language?

#area under curve, #Write a program to find the area under the curve y = f(...

#Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b.   #include float start_poi

Define static storage class - computer programming, Define Static Storage C...

Define Static Storage Class in C Programming? The Static declarations have distinct and important uses. This allows the local variable to keep its previous value when the block

Define the volatile keyword qualifiers in c language, Define the Volatile K...

Define the Volatile Keyword Qualifiers in C Language? The volatile keyword proceed as a data type qualifier and a volatile variable is for dynamic use. E.G. for data that is to

Type compatibility, Define  T y pe c o m p a t i b i li t y? ...

Define  T y pe c o m p a t i b i li t y? T o a s s i g n i n t t o s m a l l i n t t h e v a r i a b l e should b e

C program for sorting of long word with different string, C Program for SOR...

C Program for SORTING OF LONG WORD WITH DIFFERENT STRING #include stdio.h> #include conio.h> #include string.h>   void main() {           char n[50],c[25][25]

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd