0
It is necessary to declare size of array?how much memory is allocated if size isnt declared?
is array wuthout size declaration makes program slow? why we need to declare size of array as its run without declaring it then why linked lists are invented?
3 Answers
+ 6
Yes you need to provide the array size at the time of declaration. How will it work when you haven't given the array size except in the case e.g: int arr[]={1,2,3} then the size is automatically computed by the compiler.
One reason for developing linked list is that once an array is declared, its size cannot be changed unless its dynamically created, so an array size cannot be reduced or increased easily while in linked list the size is not fixed.
+ 4
Its better to use List if you don't have a fixed index to an array.
0
how much memory allocated if size is not declared?