Multiple choice technology programming languages

int ThatsMyFunction() { return 5; } void main() { printf("%u",ThatsMyFunction); }

  1. Compilation Error

  2. Some Unknown Random Number

  3. 5

  4. I Dont Know

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

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.

AI explanation

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.