What is the proper way to handle errors from function calls?

From: atv (atv-nospam_at_xs4all.nl)
Date: 11/29/03


Date: Sat, 29 Nov 2003 12:13:45 +0100

Whatis the proper way to handle errors from function calls?

For example, i normally have a main function, with calls to mine
or c functions. Should i check for errors in the functions called
themselves, or should i return a code to main and handle the error
there?

If i don't return them to main, except for the structure, what
use is the main function except for calling functions?

I hope you understand what i mean. It seems a bit silly to call a function
created by me, from main, then if a error occurs in that function, to
return the value to main and print a message there.

should i handle errors and print error messages in the called functions or
leave it up to the main() function?

What's the best way?