Write a program that illustrate Macros with Arguments, C/C++ Programming

Assignment Help:

Write a program that illustrate  Macros with Arguments?

Macros is able to also have arguments, just as functions can.

#define AREA(x)(3.14*x*x)

Then at any time the preprocessor finds the phrase AREA (x) it expands it into the statement 3.14 * x * x be careful not to leave a blank space between the macro template and its arguments while defining the macro. The whole macro expansion should also be enclosed within parentheses.

# define AREA(x)(3.14*x*x)
# include

main()
{
float x=2.5,result;
result=AREA(x);
printf("%f",result);
}


Related Discussions:- Write a program that illustrate Macros with Arguments

Implement a algorithm to verify if the link list , Implement a Algorithm to...

Implement a Algorithm to verify if the link list is in Ascending order? A: template bool linklist::isAscending() const{ nodeptr ptr = head; while (ptr->_next)

Expression and their types in cpp, E x p r e s sion and their types: ...

E x p r e s sion and their types: An expression will be in form of mathematical expression with C++ syntax embedded with it. Expressions are of following types which m

Pattern, enter height of the shape: 1 3 5 3 1 3 5 7 5 3 5 7 9 7 5 3 5 7...

enter height of the shape: 1 3 5 3 1 3 5 7 5 3 5 7 9 7 5 3 5 7 5 3 1 3 5 3 1

Copy constructor and an overloaded assignment operator, What is the differe...

What is the difference among a copy constructor and an overloaded assignment operator? Ans) A copy constructor constructs a latest object by using the content of the argument

Writing a c++ program, how can I write a c++ program that generate all evn ...

how can I write a c++ program that generate all evn numbers less than 1000?

C language, in a program for what purpose print f and scan f is used

in a program for what purpose print f and scan f is used

What is the reward of operator overloading?, A: you can exploit by overload...

A: you can exploit by overloading standard operators on a class, the intuition of the users of that class. This allow users program in the language of the problem domain instead of

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

Socket Programming, Need someone to look over my assignment for correctness...

Need someone to look over my assignment for correctness and make any necessary changes.

CarDealership, ABC Car Dealership needs your help to update the ordering sy...

ABC Car Dealership needs your help to update the ordering system. This car dealer is selling four types of vehicles: Sedan, Truck, SUV, and mini Van. And each type of vehicle can h

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