How #define stores a variable without using the memory | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How #define stores a variable without using the memory

please explain

5th Jun 2020, 9:54 AM
Smiley[Offline]
1 Answer
0
Here is an example code: #define example 1 int main(){ int var=1; if (var==example) } I know this code isn't completely right but it's enough for me to explain. So, anywhere the word example is, it will write 1. It doesn't use memory because once you run the code and you place 1 on every example that there is on the code, you won't need the memory anymore. I hope I was helpful :)
5th Jun 2020, 10:03 AM
Alexandre
Alexandre - avatar