Can someone please help me understand this code deeply please it's about constants in C language under data types... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone please help me understand this code deeply please it's about constants in C language under data types...

#include <stdio.h> int main() { const double PI = 3.14; printf("%f", PI); return 0; }

15th Jul 2020, 9:03 AM
Umutesi Daphne Rhona
Umutesi Daphne Rhona - avatar
1 Answer
0
When you declare a constant, you use the const reserved word. In this code you declare a constant of type double, which is called PI. Then, in the printer function, you pass %d because the constant is double and then you pass the constant PI Hope it helped :)
15th Jul 2020, 9:23 AM
ByRuss X
ByRuss X - avatar