home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!olivea!charnel!sifon!thunder.mcrcim.mcgill.edu!mouse
- From: mouse@thunder.mcrcim.mcgill.edu (der Mouse)
- Newsgroups: comp.lang.c
- Subject: Re: What should be returned by the functions...???
- Message-ID: <1992Dec21.173938.19490@thunder.mcrcim.mcgill.edu>
- Date: 21 Dec 92 17:39:38 GMT
- References: <BzKoIM.L3@cs.uiuc.edu>
- Organization: McGill Research Centre for Intelligent Machines
- Lines: 25
-
- In article <BzKoIM.L3@cs.uiuc.edu>, ctaylor@cs.uiuc.edu (Conrad Taylor) writes:
-
- > What should the functions, insertright and insertleft, return because
- > I'm receiving errors with Borland C++ 3.1. For exmaple, functions
- > isn't returning a value.
-
- [all but control structure removed -dM]
- > NODEPTR insertright(NODEPTR p, int x)
- > {
- > if (p == NULL) {
- > return;
- > } /* end if */
- > return;
- > } /* end insertright */
-
- You declared it as returning NODEPTR but aren't returning anything.
- The compiler is quite correct to get upset; if you declare a function
- as returning a type, you really need to return a value of that type.
- If you don't have mean for it to return anything, then declare it as
- returning void.
-
- der Mouse
-
- mouse@larry.mcrcim.mcgill.edu
-