Passing by Value vs Passing by Reference in c++





And now i will show u the difference between by value and by reference in c++ by the below example and you can test it to understand more and more


#include <iostream>
using namespace std;

//declaration the function

/**
 - value - passing parameter by value
 - @param int
**/
void value(int);

/**
 - reference - passing parameter by reference
 - @param int& - number to be incremented
**/
void reference(int&);

int main(){
int num = 5;
value(num);
cout << " the value func result is : " << num << endl;
reference(num);
cout << " the reference func result is : " << num << endl;
return 0;
}

//defination the function
void value(int num){

num+=2;
}
void reference(int& num){

num+=2;
}

0 التعليقات :

Difference between “git add -A” and “git add .”



You can test the differences out with something like this (not that for Git version 2.x your output for git add . git status will be different):







  • git add -A stages All
  • git add . stages new and modified, without deleted
  • git add -u stages modified and deleted, without new

0 التعليقات :

PhpStorm 10.0.3 – Project Data Sources: re-sync required



Turns our you simply need to synchronize your database connections, which can be done at “View > Tool Windows > Database > Synchronize (button)”

0 التعليقات :

What is an instance? || What is difference between object and instance ?


- What is an instance?    - Difference between object and instance ?

- You could think of "dog" as a class and your particular dog as an instance of that class.


OR


A blueprint for a house design is like a class description. All the houses built from that blueprint are objects of that class. A given house is an instance.



if not understanding the above words you can check the below links 

- http://whatis.techtarget.com/definition/instance
- http://stackoverflow.com/questions/3323330/difference-between-object-and-instance





0 التعليقات :