Bloomberg LP Interview Question for Financial Software Developers






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

We initialized pointer p & q to NULL.
p++ -> 4
q++ -> 8

So the output is 0 0 4 8

- redroof November 05, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

this code is for cheking the memory size of int and double

- alexy October 07, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

it will print address stored in both pointers and next they will print address +4 for int pointer and address +8 for double pointer

- ©®Ǿ September 13, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

the output will be 0 0 4 8

- Gab October 03, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

redroof is correct. (And note you cannot initiate a pointer with any other constant values except NULL or 0). Good question...

- Bill February 18, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Of course you can. It's very common, especially if you have memory-mapped hardware device registers. Just remember to cast the address appropriately.

- Tim December 12, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

It is true that one can't instantiate the pointers to values but we can definitely assign values post declaration. One more thing when integer pointer is incremented it will point to a location that is 2 bytes away and not 4 bytes since the size of int is 2 bytes.

- Ani March 04, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 votes

It's not printing the value stored at those locations, as p and q are pointers, thus printing them are printing the addresses.

alexy's answer is right.

If the output of the first printf is:
20f10 20f00
The output of the second printf is:
20f14 20f08

- Wendy November 03, 2008 | Flag


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