Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

References are safer than pointer.
The compiler will make sure that they will point to some valid data
but in case of pointer it can point to NULL also.
At some place ,you are bound to use references ,for example
in operator overloading you will have to use reference .You can't use pointers.
Pointers are used where you want to be able to change the location of reference.
For example, Linked list and Trees.

- Random Guy June 18, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

reference is like a const pointer and it cannot be re-assigned.
syntactical advantage, as reference just appear as variable names instead of &(variable_name) /* example: incrementing operator for an enum type */

- V June 19, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Reference is not const pointer. There is difference between Reference and const pointer. Const pointer will still create another memory to store address while reference doesn't allocate any new memory for storing address. They are like alias. They are still pointing to same original address.

- Yusuf July 18, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

to save memory and deferencing.....

- Anonymous August 05, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

compare to ptr variable reference variab;e is best when we modifying actual arguments because ptr variabele allocates memory but reference variable does not allocate memory its just alias name just we assigned the adress is enough

- phani kuamr rudra August 09, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Reference always refers to some object, meanwhile pointer can point to NULL.
You should use a reference when you exactly know that there is an object to refer to and you will always want to refer to that object and nothing else.

- nuna November 05, 2011 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More