GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Friday, March 11, 2011

CPP - Call By Reference

#include <iostream>

using namespace std;

void addWithTwo(int &);

void addWithTwo(int &ref){
    ref = ref + 2;
}

int main()
{
    int a = 10;
    addWithTwo(a);
    cout << a << endl;
    return 0;
}

Share/Bookmark

No comments:

Post a Comment