When defining a macro (e.g. #define BALL
). Why do people use uppercase letters? I can write something like #define ball
. It is not in uppercase, but it works.
It's convention. It makes reading and understanding code easier. It's not required, but recommended.
Why do you use _
for long variable names ? And why don't you just name variables as a or b
because It is easy to understand and debug.
Using a variable name such as TotalHeight
makes more sense than simple i
. Some people even prefix the data type such as Int_TotalHeight
. Its easy to maintain the code.
To answer your question, people use it for more understanding. Usually
1)To differentiate the variable name and macro name
#define MAX 45 // easy to understand, it is a macro
int max=45;
2)To differentiate the function from a macro. Say
#define MULT(x, y) (x) * (y)
int mult(int,int);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With