Re: Return type
- From: "Default User" <defaultuserbr@xxxxxxxxx>
- Date: 25 Aug 2005 15:45:23 GMT
danieljmathew@xxxxxxxxx wrote:
> Problem:
>
> I want to write a function for retrieving a value from a linked list,
> given the position as an int.
> Function prototype: int retrieve(int pos, List *l);
> There are 2 abnormal conditions - the position given is greater than
> the size of the list, or the list is empty. I thought of returning 0
> in case these errors occur.
> But there arises the problem - even if there's no error, zero can be
> returned (if that's the value of the node a the position pos).
What about -1?
Brian
.
- References:
- Return type
- From: danieljmathew@xxxxxxxxx
- Return type
- Prev by Date: Re: if (expression) check
- Next by Date: Re: Why doesn't strrstr() exist?
- Previous by thread: Re: Return type
- Next by thread: Re: Return type
- Index(es):
Relevant Pages
|