Hewlett Packard Interview Question for Software Engineer / Developers


Team: Networking
Country: United States
Interview Type: In-Person




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

For one, there's no free() on the allocated space.

- CHRISTOP October 23, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Return is not necessary for void functions (that's the point).

Don't cast what malloc returns, it should read.

i = malloc(sizeof(int));

- Katianie January 03, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The correct declaration if 'i' had been an array is this:

i = (int *) malloc (100 *(sizeof(int));
where 100 being the MAX array_size

- Hamsalekha February 16, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Don't cast what malloc returns, it should read.

i = malloc(sizeof(int));

- sumit May 05, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Don't cast what malloc returns, it should read.

i = malloc(sizeof(int));

- sumit May 05, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

memory allocated variable i is a local one not accessible outside function, hence it cannot be freed.

- Sam April 21, 2017 | 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