Wednesday, 11 February 2015

C++ program to illustrate the concept of call by address

C++ program to illustrate the concept of call by address
#include <iostream>
#include<conio.h>
int nFive = 5;
int nSix = 6;
void SetToSix(int *pTempPtr);

int main()
{
using namespace std;

int *pPtr = &nFive;
cout << *pPtr;
SetToSix(pPtr);
cout << *pPtr;
return 0;
}

void SetToSix(int *pTempPtr)
{
using namespace std;

pTempPtr = &nSix;
cout << *pTempPtr;
}

No comments:

Post a Comment