I can't understand why my program is facing a segmentation fault.
I decided to make my own program which counts the number of steps used in Collatz Conjecture(as discussed in week 4). The picture below is of the function which counts the steps using recursion.The main function is not included in the picture since I didn't use any pointer in the main function.
I tried declaring " int i " and "int* c" globally rather than locally in function collatz_steps() and still I came across the segmentation fault.
[I do realize that code discussed(in "shorts") by Mr.Lloyd is much better. I just wanted to write a program of my own and found this problem which I couldn't understand]