How we can make simple non-returning user defined function in c++



It is very easy to know How we can make simple non-returning user defined function in c++. These functions not return the value. There is a lot of use of these functions in c++. Non-returning functions are mostly used in c++. You can watch the code to understand the non-returning user defined functions.

Simple Structure:


dataTypeName  FunctionName ()
{

}

Code without Prototype:


#include <iostream>
using namespace std;
void Fun()
{
                cout<<"How are you."<<endl;
                cout<<"I am fine. ";
}
int main()
{
                Fun();
}

Output:


How are you.
I am fine.

Code with Prototype:


#include <iostream>
using namespace std;
void Fun();
int main()
{
                Fun();
}
void Fun()
{
                cout<<"How are you."<<endl;
                cout<<"I am fine. ";
}

Output:


How are you.
I am fine.
Hope you understand the non-returning user defined functions in c++.

Click here for watching the video of that code



avatar
AUTHOR: Muhammad Abbas
I am Software Engineer.

1 Comments
avatar

Hope you understand this program

Replay