Print Friendly and PDF
(Function Prototypes and Definitions) Explain the difference between a function prototype and a function definition.
(Function Prototypes and Definitions) Explain the difference between a function prototype and a function definition.

Solution:

A function prototype declares the details of how to call a function. For this reason, it is also known as a function declaration.

A function definition repeats and must match the prototype but additionally includes the body of the function. The body is the actual source code that implements the function's behaviour.

Separating a function's prototype from is definition allows a function to call the second function without knowing about how the second function is implemented. The first function only knows about the prototype. This allows a programmer to divide code for a program into multiple source files that are later linked together.
zubairsaif

Zubair saif

A passionate writer who loves to write on new technology and programming

Post A Comment:

0 comments: