Suppose i have defined a constant as const int MAX =5 and i am using it in a function called find().
void find()
{
if(MAX==5)
{
//do this
}
else
{
//do this
}
}
if i am calling this function for 100 of times then which way is better to define a constant as i can define a constant in 2 ways.
1 const int MAX=5
2.#define MAX 5
void find()
{
if(MAX==5)
{
//do this
}
else
{
//do this
}
}
if i am calling this function for 100 of times then which way is better to define a constant as i can define a constant in 2 ways.
1 const int MAX=5
2.#define MAX 5