Bloomberg LP Interview Question for Financial Software Developers






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

pass a pointer to pointer to foo(), and how do you free that memory in C?

void foo(char** str) {}
...
foo(&str);

Allowed to add new functions?

- rootwoot.wu March 31, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Hi,
do you guys think that this will work..?

foo( char **pp) {
  static char foo_buffer[80];
  
  /* fill something into foo_buffer  */
  //  ...

  *pp = foo_buffer;
   return;
}

main() {

    char *str;

  foo ( &str);

  printf ("%s\n", str);

}

- DavidHo July 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void foo( char ** str ){
	*str = (char *)malloc(5*sizeof(char));
	strncpy(*str, "hell", 4 );
	*(*str + 4) = '\0'; 
}

int main(void) {
	
	char * str;
	foo( &str );
	printf("%s\n", str);
	free( str );
	return 0;
}

- nharryp December 15, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

shouldnt it be just:
void foo(char *str){}
...
foo(&str);

I dont think the double star is needed.

- Anonymous October 13, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

and how are you supposed to change the pointer itself? You definitely need to pass a pointer to what you are going to change inside the function body, the "char *", so you'll need a "char **".

- juan.jose.martin.marcos.gomez August 25, 2012 | 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