In an array declaration, the size must be known at compile time. You can t specify a size that s known only at runtime. If you know that you have an array but you won t know until runtime how big it will be, declare a pointer to it.
Original Description:
Original Title
Can the size of an array be declared at runtime.txt
In an array declaration, the size must be known at compile time. You can t specify a size that s known only at runtime. If you know that you have an array but you won t know until runtime how big it will be, declare a pointer to it.
In an array declaration, the size must be known at compile time. You can t specify a size that s known only at runtime. If you know that you have an array but you won t know until runtime how big it will be, declare a pointer to it.
VYOM INTERVIEW QUESTIONS LANGUAGES C DETAIL * * * * * * * * * * * * * *
QuestionCan the size of an array be declared at
runtime?Added: 10/22/2004 CategoryCViews: 585 Rating (3.0)By: 1 users AnswerNo. In an array declaration, the size must be known at compile time. You can t specify a size that s known only at runtime. For example, if i is a variable, you can t write code like this: char array[i]; /* not valid C */ Some languages provide this latitude. C doesn t. If it did, the stack would be more complicated, function calls would be more expensive, and programs would run a lot slower. If you know that you have an array but you won t know until runtime how big it will be, declare a pointer to it and use malloc() or calloc() to allocate the array from the heap. RELATED INTERVIEW QUESTIONS QuestionWhat is the difference between far and near? Added: 10/22/2004 Rating Views: 1606 QuestionDifference between arrays and pointers? Added: 10/22/2004 Rating Views: 989 QuestionIs it possible to execute code even after the program exits the main() function? Added: 10/22/2004 Rating Views: 718 QuestionWhat is a static function? Added: 10/22/2004 Rating Views: 731
QuestionWhy should I prototype a function?
Added: 10/22/2004 Rating Views: 505 QuestionHow do you print an address? Added: 10/22/2004 Rating Views: 510 QuestionCan math operations be performed on a void pointer? Added: 10/22/2004 Rating Views: 620 QuestionHow can you determine the size of an allocated portion of memory? Added: 10/22/2004 Rating Views: 494 QuestionWhat is a null pointer assignment error? What are bus errors, memory faults, and core dumps? Added: 10/22/2004 Rating Views: 420 QuestionWhat is the difference between NULL and NUL? Added: 10/22/2004 Rating Views: 620 QuestionWhat is the heap? Added: 10/22/2004 Rating Views: 499 QuestionCan the sizeof operator be used to tell the size of an array passed to a function? Added: 10/22/2004 Rating Views: 451 QuestionWhen should a far pointer be used? Added: 10/22/2004 Rating Views: 834 QuestionIs it better to use a pointer to navigate an array of values,or is it better to use a subscripted array name? Added: 10/22/2004 Rating Views: 317 QuestionIs it better to use malloc() or calloc()? Added: 10/22/2004 Rating Views: 837
Vyom Interview Questions
This whole site - containing 3,784 Interview Questions &
Answers, as also available as an eBook. 4700+ Pages 3784 Question & Answers 81 Question Categories 128 MB Content Get it now !! Special Discount of Rs.100/- ends on Dec 16th
2004 Vyom Network All Rights Reserved
Vyom Interview Questions is a part of Vyom Network.
Other sites in Vyom Network : VyomWorld.com | Testsworld.com | JobsAssist.com | VyomLinks.com | SourceCodesWorld.com | DiscussionsWorld.com | FundooSite.com | BestEbooksWorld.com Privacy Policy Copyright 2003-2005 Vyom Technologies, All Rights Reserved. Page URL: http://www.fundoosite.com/interview-questions/interview-questions/detail.a sp?iFaq=1213&iType=40