Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Why the use of alloca() is discouraged?

Answers were Sorted based on User's Feedback



Why the use of alloca() is discouraged? ..

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

Why the use of alloca() is discouraged? ..

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

Post New Answer

More C Interview Questions

# define x=1+4; main() { int x; printf("%d%d",x/2,x/4); }

5 Answers  


how to go with this?

1 Answers   Wipro,


Do pointers store the address of value or the actual value of a variable?

0 Answers   Fidelity,


What is pointers in c with example?

0 Answers  


Can we declare a function inside a function in c?

0 Answers  


What is the difference between the = symbol and == symbol?

0 Answers  


sir i got 146 correct question & i have also the advantage of height so will they consider my marks as 146+3=149.can any body tell me how they consider my height marks.

1 Answers  


why arithmetic operation can’t be performed on a void pointer?

1 Answers  


what is the output of below int n=10; (n++)++; printf("%d",n);

3 Answers  


is it possible to change the default calling convention in c ?

1 Answers   Aptech,


What is the difference between malloc calloc and realloc in c?

0 Answers  


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

0 Answers   Reliance,


Categories