- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmacros.cpp
More file actions
Latest commit
26 lines (13 loc) · 559 Bytes
/
Copy pathmacros.cpp
File metadata and controls
26 lines (13 loc) · 559 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//macros are used to increase efficiency of program
// to increase efficiency it simply replace the defined code using "#define name val " and replace name with value
//https://geeksforgeeks.org/macros-and-its-types-in-cpp
#include<iostream>
#definearea(l, b) l*b
#defineb5
usingnamespacestd;
intmain() {
int l = 7;
int area = area(l, b); // with help of macros that area(l, b) looking like a function it will be replaced with "l*b" and as I defined b = 5 it actually replaced with "l*5"
cout << area;
return0;
}