ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
Why the use of alloca() is discouraged?
 Question Submitted By :: Mittal
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Why the use of alloca() is discouraged?
Answer
# 1
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 ?    0 Yes 2 No
Sathish Kumar
 
  Re: Why the use of alloca() is discouraged?
Answer
# 2
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 ?    6 Yes 0 No
Johnson
 
 
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
why r u join this company? give solid resons. Infosys7
write an interactive program to generate the divisors of a given integer. TCS4
how to implement stack work as a queue?  2
Write a programme to find even numbers without using any conditional statement? Infosys3
What is external and internal variables What is dynamic memory allocation what is storage classes in C  2
To what value do nonglobal variables default? 1) auto 2) register 3) static  4
int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+zap(n-1); } then the call zap(6) gives the values of zap [a] 8 [b] 9 [c] 6 [d] 12 [e] 15 Wipro8
plssssss help !!....using array.. turbo c.. create a program that will accept number of words to be consored. .a word must not exceed 10 characters long .the text to be entered will be no longer than 200 characters .there will be no 10 words example: enter number of words to be censor: 5 enter words to censor: windows office microsoft bill gates enter text to censor: bill gates founded microsoft and makes office and windows sample output: <consored> <censored> founded <censored> and makes <censored> and <censored>  1
plz answer....A program that takes 3 variables e.g a,b,c in as seperate parameters and rotates the values stored so that value goes a to b, b to c and c to a .  3
c program to add and delete an element from circular queue using array  1
Difference Between embedded software and soft ware? Bosch1
Write code for atoi(x) where x is hexadecimal string. Adobe2
What are advantages and disadvantages of recursive calling ? HP11
7. Identify the correct argument for the function call fflush() in ANSI C: A)stdout B)stdin C)stderr D)All the above Accenture8
What is an object?  3
write a addition of two no. program with out using printf,scanf,puts .  3
identify the in correct expression a.a=b=3=4; b.a=b=c=d=0; float a=int b=3.5; d.int a; float b; a=b=3.5; TCS5
What is the diffences between Windows XP and Windows Visa Aricent1
i want the code for printing the output as follows 4 4 3 3 2 2 1 1 0 1 1 2 2 3 3 4 4  1
What are the preprocessors? HP6
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com