Skip to content
Advertisement

How to print the address of a function?

I let gcc compile the following example using -Wall -pedantic:

JavaScript

I get:

JavaScript

Line 5 made my change the code like in line 6.

What am I missing to remove the warning when printing a function’s address?

Advertisement

Answer

This is essentially the only portable way to print a function pointer.

JavaScript
Advertisement