To do this reliably, you'd need to parse the C or C++ code, and then grab the function definitions from the AST the parser produces.
C is fairly easy to parse. As pavpanchekha mentions, the parser PLY comes with a C parser, and has been used to make the following relevant projects:
Parsing C++ code is more complicated.. "Is there a good Python library that can parse C++" should be of help:
C++ is notoriously hard to parse. Most people who try to do this properly end up taking apart a compiler. In fact this is (in part) why LLVM started: Apple needed a way they could parse C++ for use in XCode that matched the way the compiler parsed it.
That's why there are projects like GCC_XML which you could combine with a python xml library.
Finally, if your code doesn't need to be robust at all, you could run the code though a code-reformatter, like indent (for C code) to even things out, then use regular expressions to match the function definition. Yes this is a bad, hacky, error-prone idea, and you'll probably find function definitions in multiline comments and such, but it might work well enough..