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

#c++, There is a pebble merchant. He sells the pebbles, that are used for s...

There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides. But he sometimes mistakes doing that

C program to print r diagonal triangle, C program to print R diagonal trian...

C program to print R diagonal triangle: #define rows 3 #define cols 3 void main() {                 int i=0,j=0;                 int arr[rows][cols];

Explain virtual functions, Virtual Functions The keyword virtual was pr...

Virtual Functions The keyword virtual was previously used to resolve ambiguity for a class derived from two classes, both having a common ancestor. These classes are known as v

Implement binary heap in c++?, A:BinaryHeap.h ------------ #ifndef BI...

A:BinaryHeap.h ------------ #ifndef BINARY_HEAP_H_ #define BINARY_HEAP_H_ #include "dsexceptions.h" #include "vector.h" // BinaryHeap class // CONSTRUCTION: wi

Define procedure that take argument or return integral value, Simpson's Rul...

Simpson's Rule is a more accurate method of numerical integration than the method described in class. Using Simpson's Rule, the integral of a function f between a and b is approxim

Bank account system, To implement a back account system for new users

To implement a back account system for new users

How to write an inline class member function, How to write an inline class ...

How to write an inline class member function In addition to global functions, you may request that non-static member functions of a class be inlined.  The normal method of doin

Explain different implementations of oop, Different implementations of OOP ...

Different implementations of OOP Object-oriented programming is not mainly concerned with the details of the program operation. Instead, it deals with the overall design of the

Algorithm, Write algorithms to implement the insertion and deletion operati...

Write algorithms to implement the insertion and deletion operations.

Program to find whether a number is odd or even, PROGRAM TO FIND WHETHER A ...

PROGRAM TO FIND WHETHER A NUMBER IS ODD OR EVEN int main() { int number ; printf("Enter a whole number\n"); scanf("%d",&number); if(number % 2 == 0) printf("n

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