How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask Brian H Your Own Question
Brian H
Brian H, Computer Software Engineer
Category: Programming
Satisfied Customers: 55
Experience:  Master's degree, 8 years professional experience. C/C++/ASM/Java/ Python/PHP.
Type Your Programming Question Here...
Brian H is online now
A new question is answered every 9 seconds

Explain the difference between a function prototype and a fu

This answer was rated:

Explain the difference between a function prototype and a function definition. Use a C++ program segment to illustrate your answer
Chat Conversation Started
Brian H :

I'll have an answer here for you shortly, eagle.

Customer :

k last one

Chat Conversation Ended

If you are still working with your Expert on this question, you can post additional replies and receive additional information on this page.  If you received a satisfactory answer in Chat, you can accept the chat conversation above.
A function prototype declares the details of how to call a function. For this reason, it is also known as a function declaration.

For example:

// Below is a prototype for the add function, which adds two numbers and returns the result.
int add(int a, int b);

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 behavior.

For example:

int add (int a, int b) // Matches the prototype
    return a + b; // Performs the actual add

Separating a function's prototype from is definition allows a function to call a 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.

Brian H and 4 other Programming Specialists are ready to help you

Related Programming Questions