1
#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++, i));
}

please help me understand this code output of this code is 12345

Rafael
  • 7,605
  • 13
  • 31
  • 46
Shashi Dhar
  • 603
  • 6
  • 7
  • the `reverse()` is a `void` function, so it cannot return anything. Your compiler should have told you about this problem. When compiling, always enable the warnings, then fix those warnings. ( for `gcc`, at a minimum use: `-Wall -Wextra -Wconversion -pedantic -std=gnu11` ) Note other compilers use different options to accomplish the same results – user3629249 Oct 06 '18 at 06:52

0 Answers0