Adobe Interview Question for Software Engineer / Developers






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

calloc initializes memory allocated with 0 bytes but malloc does not

- gumber July 31, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The signatures are different, but the main difference is zeroing the allocated memory.

- Anonymous August 02, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

yes ur answers r correct

- nizam.sp August 04, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

There is one more difference which very few people know which is - Calloc returns the contiguous block of memory allocated on heap whereas for Malloc it is not the case.

- Amit Thukral September 15, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

No way. Both return the contiguous block of memory.

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

-- Difference between malloc and calloc
    -- Signatures are different
    -- Malloc(s);
        -- Allocates byte of memory
        -- Returns a pointer for enough storage for an object of s bytes

    -- Calloc(n,s);
        -- Allocates block of memory
        -- Returns a pointer for enough contiguous storage for n objects, each of s bytes
        -- The storage is all initialized to zeros
        -- Calloc(m, n) is essentially equivalent to
                p = malloc(m * n);
                memset(p, 0, m * n);

- Anonymous November 05, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Malloc returns contiguous block of memory..where as calloc returns memory of equal size blocks in non-contiguous locations..
see the link hxxp://onlamp.com/pub/a/onlamp/2005/10/27/memory-management.html

- JackMaster January 13, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Besides the difference above, calloc is more resource demanding than malloc since it is going to explicitly set all the memory blocks returned to 0.

- dagnihot March 03, 2010 | 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