Why the use of alloca() is discouraged?
Answers were Sorted based on User's Feedback
Answer / johnson
Sorry, that is not strictly correct. According to the man page:
"The alloca() function allocates size bytes of space in the
stack frame of the caller, and returns a pointer to the
allocated block. This temporary space is automatically freed
when the caller returns."
Now this is the real reason:
" If the allocated block is beyond the current stack limit,
the resulting behavior is undefined."
| Is This Answer Correct ? | 12 Yes | 0 No |
Answer / sathish kumar
Hi All,
If you use alloca inside a function when it retuns from
function it will be resulting in memory leak. Thats why
its discouraged to use.
Thanks & Regards
Sathish Kumar
| Is This Answer Correct ? | 2 Yes | 5 No |
write a program to check whether a number is Peterson or not.
What does %c do in c?
a 'c' program to tell that the set of three coordinates lie on a same line
write a c program to print "Welcome" without using semicolon in the whole program ??
What is the advantage of using #define to declare a constant?
0 Answers Agilent, ZS Associates,
Explain how can I remove the trailing spaces from a string?
why TCS selected more student in the software field from all institution.
the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b
What is scanf () in c?
Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon
What is #line used for?
question-how to run a c programme.