- Syntax :
void myFunction()
{ // declaration
// the body of the function (definition) }
- Program :
#include <iostream>
using namespace std;
// Function declaration
void myFunction();
int main(){
cout <<"\n----------------FUNCTIONS----------------\n";
cout <<"\n----------------Function Declaration & Definition,Create & Call a Function----------------\n";
myFunction(); // call the function
return 0;
}
// Function definition
void myFunction() {
cout << "C++ Programming";
}
- Output :
No comments:
Post a Comment