Q. What will be the output of the following C function?

Code:
#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));
    }
  • (A) 1 2 3 4 5
  • (B) Segmentation fault
  • (C) Compilation error
  • (D) Undefined behaviour
πŸ’¬ Discuss
βœ… Correct Answer: (A) 1 2 3 4 5

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
275
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Monu Rathod
Publisher
πŸ“ˆ
98%
Success Rate