Why is the data type of PI not specified | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why is the data type of PI not specified

After the #define there is no data type for PI, why is that

5th Dec 2018, 4:16 PM
Josh
Josh - avatar
1 Answer
+ 4
Assuming the language is C or C++ (Please add the language in the keywords!) #define is handled by the pre-processor, not the compiler. And PI is a placeholder, not a typed C variable. The pre-processor is just replacing all occurrences of the string PI in the source code with the defined value (as a replacement string) then the compiler compiles the resulting processed source code.
5th Dec 2018, 4:44 PM
ifl
ifl - avatar