#define ADD(a,b) (a)+(b)
void foo1()
{
int a=1, b=2;
int k=0;
while(k++ < 10000)
{
int c = ADD(a,b);
a = c;
}
}
void foo2()
{
int a=1, b=2;
int k=0;
while(k++ < 10000)
{
int c = a + b;
a = c;
}
}
what is the difference between foo1 and foo2. Someone asked me this question and I could not find any difference. both seem 100% same. Maybe some difference regarding memory allocation on stack? you may try to answer the question with the assumption that memory is very limited?