Memory cannot be allocated at compile time. Why we are calling it static? Because the size of this array was decided at compile-time, but the memory will be allocated during the runtime. So, this array will be created inside the stack. So, an array of size 5 will be created inside the main memory as a part of the activation record of the main function. Now, the question is where it is created? As it is created inside the main function as a variable (as a vector variable), the memory for this will be created inside the stack. int A as shown below then an array of size 5 will be created. In our programs when we declare an array, for example, we have a function called main, and inside the main function if we have declared an array i.e. Once the array is created its size cannot be modified. Static array means the size of an array is static and dynamic array means the size of an array is dynamic. Data Structures and Algorithms Tutorials.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |