The first one defines PI as a macro. The second one is a constant variable.
The constant float variable takes 4 byte of memory in the data section of the executable only once.
The macro however does not take any memory during declaration but it takes 4 bytes each time PI is assigned to a variable or used in an expression.
float f; f = (float)PI;
About our authors: Team EQA
You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Calculate weighted average