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 |
What is wild pointer in c?
To what value do nonglobal variables default? 1) auto 2) register 3) static
What is indirect recursion? give an example?
Write a C program to perform some of the operation which can be performed using Single linked list
Define Spanning-Tree Protocol (STP)
in C-programming language without using printf statement can we get output r not ? if yes how and if no also how ?
main() { int i,j,A; for(A=-1;A<=1;A++) prinf("%d\t",!!A); }
What is malloc return c?
What is function in c with example?
WHY DO WE USE A TERMINATOR IN C LANGUAGE?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
Print all numbers which has a certain digit in a certain position eg: number=45687 1 number=4 2 number=5 etc