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

Decoding the messages, 6999066263304447777077766622337778 -----> message se...

6999066263304447777077766622337778 -----> message sent by the first smuggler. my name is robert---------> message decoded by the second smuggler. Where ‘0’ denotes the "space".

Member dereferencing operators, M em b e r d e r e f e r e n c ...

M em b e r d e r e f e r e n c i ng o p e r a t o r s: T h e s e op e r a t o r s w i l l b e d i s c u s s e d l a t

Write a program that predicts users age, Write a program that predicts user...

Write a program that predicts users age: Write a program that predicts users' age (0-128 years old) with at most 7 questions. The game starts with asking the user whether he/s

Function, limitation of function

limitation of function

Why should i employ new instead of truthful old malloc()?, Why should I emp...

Why should I employ new instead of truthful old malloc()? A: Constructors/destructors, type safety, overridability. Constructors/destructors: unlike malloc(sizeof(Fred)), new

Write a program to illustrate array of structures, Write a program to illus...

Write a program to illustrate array of structures? struct customer { int id; char name[15]; }; struct customer c[100]; . In the above instance, the array of Structures is

Structures of flowchart, Ask Draw a flowchart that print all even numbers f...

Ask Draw a flowchart that print all even numbers from 2 until 10

Develop g-code generating software, Develop G-code generating software P...

Develop G-code generating software Project Description: I'm presently using Slicer on a polymer jetting 3d printer. The toolpaths were thought out for FDM printers and thus a

Explain the shift operators, The Shift Operators There are 2 shift oper...

The Shift Operators There are 2 shift operators : left shift ( >). These are binary operators. The format is                 operand >> number or operand   The first

Explain multiple inheritance, Multiple Inheritance Multiple inheritance ,...

Multiple Inheritance Multiple inheritance , as the name suggests , is  deriving a class from more than one class . The derived class inherits all the properties of all its base c

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