So i'm learning from scratch, from my workbook, but it's confusing me.
I had an excersize to do: "write a recursive sub-program that gets a number (n) and prints all the whole numbers from n to 1. meaning if n=5 it should print 5 4 3 2 1.
This is the workbook solution:
My solution was this: (they only gave the sub-program, excluding the program body so i'm not sure if the sub-program is void or int or w/e...)
mine didn't work:
int num(int n);
printf("Enter a number:");
int num(int n)
I don't know what i did wrong, cause i tried to do it like they wanted and it just printed "55555" endlessly, and my method prints out "54" only...