php hit counter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
call by value, call by reference,call by pointer in data structure 2012
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#1
call by value

call by reference

call by pointer




Call by Value: When passing data by value, the data is copied to a local variable/object in the function. Changes to this data are not reflected in the data of the calling function. For larger objects, passing data by value can be very expensive.
Example:
void by_value(int a)
{
a+=10;
}

Call by Reference:When passing data by reference, a pointer to the data is copied instead. Changes to the data pointed to by the pointer are reflected in the data of the calling function. Regardless of the size of the object, passing data by reference always has the same cost.
Example:
void by_ref2(int &a)
{
a+=10;
}
Call by Pointer: When passing parameters to functions, the difference between references and pointers is that pointers can be null whereas references cannot. Pointers are preferred if null is a valid parameter value or if there is no alternative. Otherwise use const or non-const references.
Example:
void by_ref(int *a)
{
(*a)+=10;
}

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  i take input from getchar(); function in program in C++ 2012 Vuhelper 0 3,056 05-31-2012, 01:40 AM
Last Post: Vuhelper
  what is meant by trivial and non trivial in C and C++ 2012 Vuhelper 0 4,108 05-31-2012, 01:38 AM
Last Post: Vuhelper
  how can i mail you the snapshot of compiled files.in C++ 2012 Vuhelper 0 2,922 05-31-2012, 01:32 AM
Last Post: Vuhelper
  protected inheritance and abstract classes in C++ 2012 Vuhelper 0 1,764 01-14-2012, 05:48 PM
Last Post: Vuhelper
  std::cout<<"---"; " and also for cin " std::cin>>x; in C++ 2012 Vuhelper 0 3,195 01-14-2012, 05:46 PM
Last Post: Vuhelper
  program Output in C++ 2012 Vuhelper 0 3,022 01-06-2012, 12:28 AM
Last Post: Vuhelper
  Threaded Binary Tree? in C++ 2012 Vuhelper 0 3,533 01-06-2012, 12:25 AM
Last Post: Vuhelper
  Explain the difference b/w Null Pointer and Null Nodes? C++ 2012 Vuhelper 0 1,991 01-06-2012, 12:24 AM
Last Post: Vuhelper
  What is the difference b/w Inorder Traversal and Inorder Successor? 2012 Vuhelper 0 1,825 01-06-2012, 12:23 AM
Last Post: Vuhelper
  What is mean by octet? how they are converted? in C++ 2012 Vuhelper 0 1,826 01-04-2012, 11:10 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support