hello sir..
that was great..i want to know more about recursive functions .Do u have anything for me.
A function is recursive if it calls itself. Generally they are used with linked lists (as shown) or in mathematical formulas where you generate the (n+1)th term from the nth term, i.e. factorial where n! = n * (n-1)!.
You need to have a stop condition in a recursive function, that is a definate condition where the function wont call itself, in the example given the stop condition is p == NULL, which is a good one for a linked list.
The danger of recursive functions is that you call it for a recurstion that is so deep (i.e. the function calls itself so many times)that you run out of stack space for the stack frame each function call creates. This results in a system crash normally (you can easily simulate this by writing a recursive function with no stop condition and seeing what it does).
In your case this could happen if the list of numbers entered was too long (you have no limit on the length of the list).
However since your create function is already recursive you would probably reach this condition while creating the list.
It is normally possible to replace a recursive function with an iterative one (that is a function using a loop), however in the particular case of iterating backwards through a singly linked list it requires a double (nested) loop and so is quite inefficient.
The advantage of an iterative function is that you wont run out of stack space while running it (unless of course you are already knee deep in function calls). You create function could fairly easily be changed from a recurse to an iterative function.