& operator optional in function pointer assignment

You are correct that the & is optional. Functions, like arrays, can be automatically converted into pointers. It’s neither compiler-specific nor the result of different language standards. From the standard, Section 6.3.2.1, paragraph 4:

A function designator is an expression that has function type. Except when it is the operand of the sizeof operator or the unary & operator, a function designator with type “function returning type” is converted to an expression that has type “pointer to function returning type“.

Leave a Comment