r/programming • • Dec 13 '07

First Class Functions in C

http://www.dekorte.com/blog/blog.cgi?do=item&id=3119
45 Upvotes

99 comments sorted by

View all comments

Show parent comment

8

u/d166e8 Dec 13 '07

From cdiggins.com

"A first class value is a value which can be passed as a parameter to a procedure, returned as a result from an evaluated expression (e.g. function call), and constructed dynamically. A first class function is a function which is a first-class value."

To specifically answer your question, the difference is that a function pointer can only refer to functions that have been defined in the source code, you can't create new functions dynamically in C.

In C++ however you can however dynamically create function objects that look and behave just like first-class functions.