Asked by Peter Manyang Bichok on Jun 10, 2024
Verified
The header line ____ declares calc to be a pointer to a function that returns an integer.
A) int *calc()
B) int (*calc) ()
C) int &calc()
D) int calc(*)
Pointer
A variable that stores the memory address of another variable, allowing for indirect manipulation and access of its value.
Function
A set of instructions encapsulated together to perform a specific task within a program, capable of being called and executed multiple times.
Header Line
A line of text at the top of a file, document, or message providing metadata, descriptive information, or directives for processing.
- Understand the concept of function pointers and their declaration.
Verified Answer
YH
Yasir HussainJun 14, 2024
Final Answer :
B
Explanation :
Option B, "int (*calc)()" correctly declares calc as a pointer to a function that returns an integer. The parentheses around *calc are necessary to indicate that calc is a pointer to a function, rather than a function returning a pointer to an int.
Learning Objectives
- Understand the concept of function pointers and their declaration.