C++ Programming - References - Discussion
Discussion Forum : References - General Questions (Q.No. 5)
5.
Which of the following statement is correct about the references?
Discussion:
6 comments Page 1 of 1.
Sukkha said:
1 year ago
Why D is not the answer? Please explain it.
Tom said:
2 years ago
If a reference must always be initialized, then isn't A also true? References within functions must always be initialized because references must always be initialized.
Prashant Srivastava said:
7 years ago
It will be compilation error if you don't initialize the reference at the point of declaration. for e.g
int main(void)
{
int a =11;
int &b;
}
The above code wont compile unless we put the statement as int &b =a; instead of int &b;
int main(void)
{
int a =11;
int &b;
}
The above code wont compile unless we put the statement as int &b =a; instead of int &b;
Divya said:
8 years ago
Why, can any one explain it?
Kushal said:
9 years ago
Its not necessary let it print garbage value.
Shristy said:
10 years ago
Because if we will not initialize the reference, it will take garbage value.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers