Difference between pass by reference and pass by value?

5 replies [Last post]
dhanunjaya
Offline
Last seen: 10 years 4 weeks ago
Joined: 2009-04-26
bOt Points: 153

Difference between pass by reference and pass by value?

shotgun
Offline
Last seen: 10 years 44 weeks ago
Joined: 2009-03-20
bOt Points: 122
reply!

Pass by value means to directly pass the value of variable to a function.

 

whereas

 

pass by refernce means to pass the address of the variable in a function and not the exact value.

sunand20
Offline
Last seen: 10 years 42 weeks ago
Joined: 2009-06-14
bOt Points: 268
Pass by value: When values

Pass by value:

When values of arguments are passed from calling function to a called function these values are copied into the called function. If any changes are made to these values in the called function, there is no change in the original values within the calling function.

 

Pass by reference:

In this method, the addresses of variables are passed. If any changes is made to the values in the called fuction, then the original values get changed within the calling function.

laxmi
Offline
Last seen: 10 years 25 weeks ago
Joined: 2009-08-20
bOt Points: 58
AVR

what is d function of TCK & TMS port pins(pc.2 &pc.3) respectively

shobhitkukreti
Offline
Last seen: 10 years 2 days ago
Joined: 2009-04-28
bOt Points: 683
Read a magic book called

Read a magic book called datasheet for all your queries

j.sushanthkumar
Offline
Last seen: 10 years 31 weeks ago
Joined: 2009-08-21
bOt Points: 66
data treated

when its pass by refrence we pass the address of the variable ,but in case of the pass by value its just send the copy of the vaue stored in the variable address