On Sat, Aug 14, 2010 at 1:51 PM, Alex yu <[email protected]> wrote:
> provided with a struct:
> struct Person{
>     char name[10];
>     unsigned int id;
> };
>
> and a function :
> Person get_person( int)
> if the check in get_person failed, what should get_person return?
> for example
> if(int <0){
>   return #Oh, what should I return?
> }

1) Return a pointer to a struct Person instead, and return NULL on failure
2) Supply a pointer to struct Person as another parameter which will
be filled out, and return an int indicating success or otherwise.

-- 
PJH

Reply via email to