Q:

CAN ARRAY SIZE BE DECLARED AT RUN TIME?

belongs to collection: C INTERVIEW QUESTIONS AND ANSWERS

0

CAN ARRAY SIZE BE DECLARED AT RUN TIME?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Array size can’t be declared at run time. Size of array must be known during compilation time. So, array size should be declared before compilation.

  • Correct example: char array [10];
  • Wrong example: char array[i];
  • Always, Array subscript should be positive and it should not be either negative or any variable name.
  • If we really don’t know the size of an array, we can use dynamic memory allocation concepts in C which uses malloc(), calloc() functions to allocate memory during execution time.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C INTERVIEW QUESTIONS AND ANSWERS

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
WHAT IS MEMORY LEAK IN C?... >>
<< WHAT IS THE DIFFERENCE BETWEEN NULL POINTER AND UN...