Pass by Reference or Passing Pointer to a Function in c++
This video tutorial explains how to pass a pointer to a function which is also called pass by reference in c++.
You will learn what happens when a pointer is passed to a function in c++, how to access the pointer in c++, how to pass the pointer to a function in c++ in detail with examples.
source code for this tutorial
#include <iostream>
using namespace std;
void display(int *ptr);
int main()
{
int age = 24;
display(&age);
cout << age << endl;
return 0;
}
void display(int *ptr){
cout << *ptr << endl;
*ptr = 100;
}