C++ Program for function with argument and no return value


In this program, You will learn how to create a function with argument and no return value in C++.


void change(int x){ }


Example: How to create a function with argument and no return valuen in C++

Run it Now
#include<iostream>
using namespace std;

void change(int x) {
   x = x + 10;
   cout<<"\nValue is : "<< x;
}

int main() {

   int x, y;
   cout << "Enter a number : ";
   cin >> x;

   change(x);

   return 0;
}

Output:

Enter a number : 12
Value is : 22