What is the difference between #define a 10 and const int a=10; ? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 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 Respuesta
+ 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