In the above block of code, I am trying to understand how the line return reverse((i++, i))
is working.
#include <stdio.h>
void reverse(int i);
int main()
{
reverse(1);
}
void reverse(int i)
{
if (i > 5)
return ;
printf("%d ", i);
// return reverse(i++); -- stack overflow
return reverse((i++, i));
}
I also found the below piece of code which works similarly.
#include <stdio.h>
int main()
{
int y = 1, x = 0;
int l = (y++, x++) ? y : x;
printf("%d\n", l);
}
I am sorry if the question is very basic one. I felt it very difficult to understand. If someone can explain, it will be helpful.