Thursday, May 21, 2020

Call a function & function declaration,definition in C++


  • 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

Function Overloading in C++

https://monitechvenkat1620.blogspot.com Program : #include <iostream> using namespace std; int c(int x, int y) {   return...