C Programming - Memory Allocation - Discussion

Discussion Forum : Memory Allocation - General Questions (Q.No. 2)
What function should be used to free the memory allocated by calloc() ?
malloc(variable_name, 0)
memalloc(variable_name, 0)
Answer: Option
No answer description is available. Let's discuss.
22 comments Page 1 of 3.

Anonmyous said:   8 years ago
@N. Gayathridevi.

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

In that header file examples are given.

MalliReddy said:   8 years ago
In C editor goto alloc.h you will find answer to this question and other memory management func:'s.

Bindu said:   8 years ago
Memory allocated by malloc and calloc are deallocated by free in C.

N.Gayathridevi said:   8 years ago
Explain malloc and calloc with example?

Geetha said:   8 years ago
What is the purpose of malloc?

Alex said:   9 years ago
Memory allocated by malloc or calloc : deallocated by free().
Memory allocated by new(in c++) : deallocated by delete().

Tuks bande said:   10 years ago
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".

Suvrajeetlenka said:   10 years ago
Can anybody explain what is free() and farfree()?

Vinay said:   1 decade ago
Also Calloc() initialize the allocated memory to zero, while malloc() doesn't.

Soundaryakumari .b said:   1 decade ago
free() : Releases the specified block of memory back to the system.

Post your comments here:

Your comments will be displayed after verification.