Advertisement

Function Prototypes in c++ || Code with abuzar

    In this tutorial we are learning about function prototypes in C++ 


Function prototype is a user defined function prototyping is a function make the program easier and easy to read and convinient .

Function prototype is usually written at the beginnning of the program main() , we can ads as parameter to the functions as we can programmer needs.


Making Function Prototype 3 Steps :

  1. Function Prototype ;
  2. Function Definitation ;
  3. Function Call ;

C++ function Decleration 

Return type Function name ( parameter 1 , paramater 2 ) {

// Function Body  

}


Example of Function Prototypes 

#include<iostream>
using namespace std;
int add(int x,int y); // Function Declaration
int main() {
int a=10,b=20,c;
c = add(a,b); // Function Call
cout<<"Addition : "<<c;
}
int add(int x,int y) // Function Definition
{
int z;
z = x+y;
return z;


Function prototype as same as function but some changes has been in function prototype function is also a user defind data which is entered by the user as he want . use of function prototype is our code make easier and easy to understand ..




if you have more knowledge about function prototypes so you can share with us : 

@ abuzar.abuzar.mohd325@gmail.com 




Post a Comment

0 Comments