typedef function?

I've seen people using typedef with types like int, void, double etc. And I just found out that you can use typedef for functions...but how do I use it?

typedef int foo(int x, int y);


Also, what does c_str do? (can you give me an example? thanks..)
http://www.cplusplus.com/reference/string/string/c_str/ (example on that page)

http://en.wikipedia.org/wiki/Typedef#Usage_in_C.2B.2B
http://www.cprogramming.com/tutorial/typedef.html

No offence, but google is excellent for theory or reference-based questions like this.
Last edited on
http://en.wikipedia.org/wiki/Typedef#Using_typedef_with_function_pointers

In your example you are trying to typedef a function (not a function pointer), which may simplify and document the declarations of a lot of functions (just declaration)
Topic archived. No new replies allowed.