pass.by.reference.example

pass.by.reference.example - return 0; } void pass( int...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> using namespace std; void pass( int test_par); void pass_reference( int &test_par); int main() { int test; test = 1; cout << "inside main \n" ; cout << " test " << test << " test address " << &test <<endl; pass(test); cout << "back in main \n" ; cout << " test after call by value " << test<< endl; cout << " test " << test << endl; pass_reference(test); cout << "back in main \n" ; cout << " test after call by value " << test << endl;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: return 0; } void pass( int test_par) { cout << "inside pass by value" << endl; cout << " test " << test_par << " test address " << &test_par <<endl; test_par = 2; cout << " test " << test_par<< endl; } void pass_reference( int &test_par) { cout << "inside pass_reference " << endl; cout << " test " << test_par << " test address " << &test_par <<endl; test_par = 2; cout << " test " << test_par<< endl; }...
View Full Document

This note was uploaded on 02/05/2012 for the course CIS 210 taught by Professor Feinstein during the Fall '10 term at S. Alabama.

Ask a homework question - tutors are online