int ThatsMyFunction() { return 5; } void main() { printf("%u",ThatsMyFunction); }
-
Compilation Error
-
Some Unknown Random Number
-
5
-
I Dont Know
The printf statement uses %u format specifier with ThatsMyFunction without parentheses, so it prints the function's memory address (a random-looking number) instead of calling it. To print the return value 5, you need ThatsMyFunction(). The %u format expects unsigned int, and a function pointer address fits this.
Referencing a function name without parentheses, like ThatsMyFunction, yields the function's memory address (a function pointer), not the value it returns. Printing that address with %u (an unsigned int format specifier) just prints whatever numeric value the address happens to be, which looks like an arbitrary/random-looking number rather than the return value 5.