When you call malloc() to allocate memory for a local
pointer, do you have to explicitly free() it?

Answers were Sorted based on User's Feedback



When you call malloc() to allocate memory for a local pointer, do you have to explicitly free() it?..

Answer / shruti

yup.. we have to explicitly free it..
otherwise it results in "dangling pointer"..

Is This Answer Correct ?    20 Yes 0 No

When you call malloc() to allocate memory for a local pointer, do you have to explicitly free() it?..

Answer / guest

Yes you have to.

Is This Answer Correct ?    13 Yes 1 No

Post New Answer

More C Interview Questions

Write a program in C to print the alphabets in order as on a mobile phone.i.e:When 2 is pressed once 'a' prints and if it is pressed two times 'b' prints and so on.we have to print all the alphabets as on mobile phone like this.

1 Answers   Wipro,


Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.

0 Answers   Wipro,


Derive the complexity expression for AVL tree?

1 Answers  


Can you mix old-style and new-style function syntax?

0 Answers  


what is difference between array of characters and string

18 Answers   Accenture, Nest,






void main() { int x=25,y=32; clrscr(); x=x++ + y++; y=++x + ++y; printf("%d%d",x,y); }

5 Answers  


What type of function is main ()?

0 Answers  


Why do we need functions in c?

0 Answers  


Why does notstrcat(string, "!");Work?

0 Answers  


Explain demand paging.

1 Answers   Agilent,


What is typedef struct in c?

0 Answers  


Write a program for print infinite numbers

3 Answers   Wipro,


Categories