Use Pointer as function parameter in C plus plus programming language

Author: Al-mamun Sarkar Date: 2020-04-03 17:08:46

Use Pointer as function parameter in C plus plus programming language. The following code shows how to use pointer as function's argument / parameter in C plus plus Programming Language.

 

Code:

#include<iostream>
using namespace std;

void increment(int *a)
{
    *a = *a + 1;
}


int main()
{
    int a = 15;
    increment(&a);
    cout<<"The New value of a is: "<<a;

    return 0;
}

 

Output:

The New value of a is: 16