Re: Return type



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
.



Relevant Pages

  • Re: Any monitor repair guys in Ohio?
    ... Not sure why Brian, but I can't seem to download your message. ... just sits there retrieving. ... Prev by Date: ...
    (rec.games.video.arcade.collecting)
  • Re: get day of the month
    ... int day = dt.Day; ... > TIA ... Prev by Date: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Linux 2.6.32.19
    ... +static inline int s390_nohz_delay ... unsigned long prev; ... struct irq_desc *desc; ... return ret; ...
    (Linux-Kernel)
  • Re: using string instead of int
    ... when retrieving in .aspx code. ... >>> converting to an int and then storing in an int variable. ... Do your database design. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Letter frequency of Chinese pinyin
    ... >Brian M. Scott wrote: ... >int compare ... >{register FREQ *p; ...
    (sci.lang)