Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ call by reference

#include <iostream>

using namespace std;

void increment(int &n){
    n++;
   cout<<"In function: "<<n<<endl; 
}

int main()
{
   int x=5;
   increment(x);
   cout<<"In main: "<<x<<endl;
   
}
 
PREVIOUS NEXT
Tagged: #call #reference
ADD COMMENT
Topic
Name
9+6 =