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

Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result

0 Answers  


read an array and search an element

1 Answers  


what is the difference between procedure oriented and object oriented progaming language

1 Answers  


can anyone please tell about the nested interrupts?

0 Answers  


How to Clear last bit if it 1 using Macro TURN_OFF_BIT_LAST

6 Answers   Adobe, Huawei,






main() { int i,j,A; for(A=-1;A<=1;A++) prinf("%d\t",!!A); }

6 Answers  


What is %lu in c?

0 Answers  


Explain what is the heap?

0 Answers  


how can i make a program with this kind of output.. Enter a number: 5 0 01 012 0123 01234 012345 01234 0123 012 01 0

4 Answers   Wipro,


What library is sizeof in c?

0 Answers  


What is a rvalue?

0 Answers   Global Logic,


What does the format %10.2 mean when included in a printf statement?

0 Answers  


Categories