C Programming - Memory Allocation - Discussion

Discussion Forum : Memory Allocation - General Questions (Q.No. 1)
1.
Which header file should be included to use functions like malloc() and calloc()?
memory.h
stdlib.h
string.h
dos.h
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
37 comments Page 3 of 4.

Gayathri said:   1 decade ago
It is the files which helps us to use some library files in our program. And number of files are pre-created and stored as header file. We can use those files by giving the line #include<stdio.h>

".h" is the extension of header file.

Ravi said:   1 decade ago
What is a header file?

Arti dixit said:   1 decade ago
How many prototype related to memory allocation?

Muskaan said:   1 decade ago
int *x;
x = (int *)malloc(n * sizeof(int));
This will allocate n element array of int type elements.

Soundarya kumari.b said:   1 decade ago
C dynamic memory allocation refer to perform the dynamic memory allocation is present in standard library namely malloc(), calloc(), realloc().

Ravindra said:   1 decade ago
Which one is better out of malloc() and calloc() to allocate memory for a variable ? Can any one please explain this ?

Sunil said:   1 decade ago
malloc() simply assigns a memory block to a pointer while calloc() assign block as well as in initialize all its elements to zero.

Kunjal said:   1 decade ago
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.

Latha said:   1 decade ago
Give difference of malloc & calloc ?

Gudevenkatrao said:   1 decade ago
What is the syntax of malloc() ?


Post your comments here:

Your comments will be displayed after verification.