Navigate/Search

Function Declaration/Prototype vs. Function Definition/Body

Here are some examples of function declaration also known as “prototype” (or vice-versa) and function definition also known as “body” (or vice-versa).

function int functionThatReturnsAnInt(int p1, int p2); // declaration/prototype

function int functionThatReturnsAnInt(int p1, int p2) // declaration
{
  return p1 + p2; // definition/body
}

This may even explain it better.

Comments are closed.