There are a number of tools that operate on source code and will
give you information like this. "cproto", for example, will give
you a list of prototypes for the external functions. (and, of
course, those include the function names). These depend on being
able to read C source code as a text file, and are fairly portable.
Some of them invoke the C preprocessor, which isn't portable. Some
of those that don't invoke the C preprocessor can get confused by
macros used in defining functions.
An executable or object file may also contain the function names
(if not stripped) mangled appropriately (some implementations add
a leading underscore or make other changes to the name to avoid
assembler keywords. In C++ the function name may be horribly mangled
to indicate argument and return types.). Tools such as "nm" or
"objdump" may be available. It is common that there is a symbol
"type" that allows you to distinguish between functions and variables,
and to identify static vs. non-static names. This is all very
system-dependent.
There is no guarantee that a running executable can find its own
name accurately, and if it does, that it can open up the executable
to look at the symbols. And, of course, looking at the symbols is
very system-dependent.
Is there any particular reason why this function should *NOT* also
give you "main", "printf", "exit", "getchar", etc. ?