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

Constructors and methods program, To complete this assignment, edit the fol...

To complete this assignment, edit the following constructors and methods: 1. public MaxPQ(Key[] keys) - change the following loop for (int k = N/2; k >= 1; k--) sink(k);

Explain pointers to objects, Pointers to Objects Passing and returning ...

Pointers to Objects Passing and returning of objects is, though, not very efficient since it includes passing and returning a copy of the data members. This problem can be elim

Basics, conceptual difference between big o,big thete and big omega

conceptual difference between big o,big thete and big omega

Decode the Code, Smugglers are becoming very smart day by day. Now they hav...

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

Define the processing of a structure, Define the Processing of a Structure?...

Define the Processing of a Structure? The members of structure are typically processed individually as separate entities. So we must be able to access the individual structure

Describe how a structure differs from a union, Question : (a) How does...

Question : (a) How does a structure differ from an array? (b) Describe how a structure differs from a union? (c) Declare a union called ‘clothes' which consists of the

Find area, #question.to determine the area of a triangle,rectangle and tra...

#question.to determine the area of a triangle,rectangle and trapezium

Employee salary, wap to read an employee salary and calculate DA,HRA,pf,GRO...

wap to read an employee salary and calculate DA,HRA,pf,GROSS,NET conditions:- BASIC DA HRA PF >10000 7% 9% 10% & >20000 9% 11% 15% &

Add guts to vs 2008 c++ windows service, Add guts to VS 2008 C++ windows se...

Add guts to VS 2008 C++ windows service Project Description: I have a shell windows32 service written in 2008 VS C++. I want the functionality part started. Need someone too

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