TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Monday 13 July 2020

Function Prototype In C++ | Function Prototype In C++ In Hindi

Function Prototype In C++

The function prototypes are used to tell the compiler about the number of arguments and about the required datatypes of a function parameter, it also tells about the return type of the function. By this information, the compiler cross-checks the function signatures before calling it. If the function prototypes are not mentioned, then the program may be compiled with some warnings, and sometimes generate some strange output.

The compiler does not find what is the function and what is its signature. In that case, we need to function prototypes. If the function is defined before then we do not need prototypes.


download image of Function Prototype In C++

Fig:Function Prototype In C++

Program Without Prototype

#include<iostream.h>

main()

{

function(50);

}

void function(int x);

{

cout<<”the value of x is : “<<x;

}

Output:

[warning] function should return type

[warning] function should have prototype


Program With Prototype

#include<iostream.h>

void function(int); //prototype

main()

{

function(50);

}

void function(int x);

{

cout<<”the value of x is : “<<x;

}


Output:

The value of x is:50


No comments:

Post a Comment