What is the difference between pass by reference and pass by
value?
Answer Posted / chinna
in Pass by value; if any change in variable in the sub-
function may not reflected to the main function. where as
in pass by reference the change in the variable may reflect
to the original value in the main funtion.
ex : // Pass by Reference
void Get( int &nIndex){
nIndex = 10;
}
void main()
{
int x = 100;
cout<<Get( x );
}
o/p : 10;
ex : // Pass by Value
void Get( int nIndex){
nIndex = 10;
}
void main()
{
int x = 999;
cout<<Get( x );
}
o/p : 999
| Is This Answer Correct ? | 29 Yes | 17 No |
Post New Answer View All Answers
Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?
What is abstraction with example?
What is a class in oop?
What is cohesion in oop?
What is polymorphism in oops with example?
What is the difference between a mixin and inheritance?
What is overloading in oops?
what are the different types of qualifier in java?
This program numbers the lines found in a text file. Write a program that reads text from a file and outputs each line preceded by a line number. Print the line number right-adjusted in a field of 3 spaces. Follow the line number with a colon, then one space, then the text of the line. You should get a character at a time and write code to ignore leading blanks on each line. You may assume that the lines are short enough to fit within a line on the screen. Otherwise, allow default printer or screen output behavior if the line is too long (i.e., wrap or truncate). A somewhat harder version determines the number of spaces needed in the field for the line numbers by counting lines before processing the lines of the file. This version of the program should insert a new line after the last complete word that will fit within a 72-character line.
String = "C++ is an object oriented programming language.An imp feature of oops is classes and objects".Write a pgm to count the repeated words from this scenario?
what type of question are asked in thoughtworks pair programming round ?
What is difference between pop and oop?
2. Give the different notations for the class.\
How to use CMutex, CSemaphore in VC++ MFC
What is overriding in oops?