What should malloc() do?



What should malloc() do?..

Answer / Mohammad Sartaj

In C, 'malloc()' is used to dynamically allocate memory for a program. It returns a pointer to the allocated memory block or NULL if an error occurs.n`int *array = (int *)malloc(10 * sizeof(int)); /* allocates 10 integers */n"`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......

0 Answers  


What is wild pointer in c?

1 Answers  


Which command is more efficient? *(ptr+1) or ptr[1]

3 Answers  


typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none

1 Answers  


Explain how can type-insensitive macros be created?

1 Answers  


Is array name a pointer?

1 Answers  


what is meant by c

9 Answers   INiTS,


difference between spiral and waterfall model

1 Answers  


how to print this pyramid * * * * * * * * * * * * *

2 Answers  


how to execute with out main in cprogram

15 Answers   Infosys,


How do you define a string?

1 Answers  


i want the code for printing the output as follows 4 4 3 3 2 2 1 1 0 1 1 2 2 3 3 4 4

2 Answers  


Categories