Use a function prototype to enforce strong type checking : function prototype « Function « C++ Tutorial






#include <iostream> 
#include <cstdlib> 
using namespace std; 


void f(int i); // prototype 
 
int main() 
{ 
  int x = 10;   
  f(x);
 
  return 0; 
} 
 
void f(int i) 
{ 
  i = i * i;  
  cout << i;
}
100








7.2.function prototype
7.2.1.Use a function prototype to enforce strong type checking
7.2.2.Use a function's definition as its prototype, appears before main
7.2.3.Returning a pointer from function