What is the difference between #define a 10 and const int a=10; ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the difference between #define a 10 and const int a=10; ?

23rd Jul 2019, 11:16 AM
MADHU KUMAR KOULAS
MADHU KUMAR KOULAS - avatar
1 Answer
+ 2
a = 10; "a" variable is not sure what data its allowed to store. int a = 10; "a" variable knows its datatype is int and as 10 is a integer it now knows how to store it. think of a datatype as a contract that it has to abide.
23rd Jul 2019, 11:41 AM
D_Stark
D_Stark - avatar