Nov 28, 2012 at 7:49pm UTC
Well is ptr initialized anywhere? You didn't post the calling code. I also think you're getting confused with pointer notation.
return len(*ptr->next)+1;
This means nothing unless ptr is a pointer to a pointer, which it isn't.
if (*ptr!=0)
Are you checking to see if the pointer is not null? Get rid of the asterisk. Right now you're checking to see if the value pointed at by ptr is not 0.
Nov 28, 2012 at 8:01pm UTC
but i have no other choices to finds the length of a linked list
recursively other than this cuz we wont be able to use more variables unless we need it.
*ptr is already initialized in the class itself
Nov 28, 2012 at 8:02pm UTC
Oh, you're missing the starting bracket for your function.
And what I said about pointer notation still stands.
Nov 28, 2012 at 8:05pm UTC
even if i took out the pointer and change the variable i get the same error> I hate errors that i dont understand i wont be able to fix it!!!!!!
Nov 28, 2012 at 8:08pm UTC
I told you what the problem was, you're missing your opening bracket for your function.
Nov 28, 2012 at 8:17pm UTC
its not about the bracket cuz still m having the same error