C Programming - Memory Allocation - Discussion


What function should be used to free the memory allocated by calloc() ?

[A]. dealloc();
[B]. malloc(variable_name, 0)
[C]. free();
[D]. memalloc(variable_name, 0)

Answer: Option C


No answer description available for this question.

Wahid Sayed said: (Oct 20, 2010)  
Why is it free() ?

Can anyone explain me.

Vamshikrishna Adepu said: (Nov 6, 2010)  
We doesn't functions like dealloc() in "C" and the remaining options are to allocate memory so may the answer is free().

Rahul said: (Nov 12, 2010)  
There are only 3 memory allocation functions in C calloc(),malloc() and free(). free is to free that allocated space

Anil Kumar said: (May 7, 2011)  
free() is one of the predefined function its free memory ...
only one function is there in c language to free memory....

Hari Naidu said: (Jun 19, 2011)  
free() function is used to remove the allocated memory.

Venkat said: (Jul 30, 2011)  
Mainly free() function is used for allocating free memory for malloc() and calloc().

Amrendra said: (Aug 16, 2011)  
The free(var-name) is only function in c to deallocate memory.

Pokar Sanjay said: (Oct 8, 2011)  
How is different between malloc() and calloc() what is function of both? How it work?

Krishna said: (Nov 29, 2011)  
Both allocate storage memory but the difference is malloc process single argument so just specify storage space while calloc process double argument so specify no. Of variable and space needed for that variable.

Sri said: (Dec 6, 2011)  
What are the functions of malloc and calloc?

Lijina said: (Jan 28, 2012)  
malloc() and calloc() are used to allocate space in memory but one difference is there allocating methods.

malloc() : malloc(int) only passing one arguments int allocates 2 bytes.

calloc() : calloc(int,5) passing two arguments int allocates 2 bytes, also 5 times 2 bytes will allocates.

Pandiya Raja said: (Aug 7, 2012)  
@Lijina. What is malloc() and calloc() ?

Can you explain with example program ?

Soundaryakumari .B said: (Oct 3, 2012)  
free() : Releases the specified block of memory back to the system.

Vinay said: (May 15, 2013)  
Also Calloc() initialize the allocated memory to zero, while malloc() doesn't.

Suvrajeetlenka said: (Jul 13, 2013)  
Can anybody explain what is free() and farfree()?

Tuks Bande said: (Aug 8, 2013)  
Is the following statement a declaration or definition?

extern int i;

A. Declaration B. Definition
C. Function D. Error

Answer & Explanation

Answer: Option A.


Declaring is the way a programmer tells the compiler to expect a particular type, be it a variable, class/struct/union type, a function type (prototype) or a particular object instance. (ie. extern int i).

Declaration never reserves any space for the variable or instance in the program's memory; it simply a "hint" to the compiler that a use of the variable or instance is expected in the program. This hinting is technically called "forward reference".

Alex said: (Jun 19, 2014)  
Memory allocated by malloc or calloc : deallocated by free().
Memory allocated by new(in c++) : deallocated by delete().

Geetha said: (Jan 2, 2015)  
What is the purpose of malloc?

N.Gayathridevi said: (Feb 27, 2015)  
Explain malloc and calloc with example?

Bindu said: (Mar 7, 2015)  
Memory allocated by malloc and calloc are deallocated by free in C.

Mallireddy said: (Aug 27, 2015)  
In C editor goto alloc.h you will find answer to this question and other memory management func:'s.

Anonmyous said: (Aug 27, 2015)  
@N. Gayathridevi.

In c++ editor goto help and look for alloc.h.

In that header file examples are given.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.