Interview Question


Country: India
Interview Type: Phone Interview


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

Pointers are special types of variables that can hold the memory location (point to the address) of another variable
or just point directly to a specific memory location, which should be within the valid range for your process.
Below are some use cases for pointers:
1. Allocate a storage for a specific variable and store that location address in a pointer;

2. Use pointers to pass the variable to other functions (compare with pass by value scenario).
The called function will actually change the original variable's value when using the passed in
pointer to modify that variable inside the function (again, compare with the "by value" scenario
when the modified variable does not affect the original variable);

3. Pointers are very extensively used in h/w programming, e.g storing the address of a variable in h/w registers;

4. For all the other cases, please consult any C/C++ books :) or just use Wiki

- ashot madatyan on July 25, 2012 | Flag Reply


Add a Comment
Name:

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

Books

is a comprehensive book walking you through 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