The Gateway to Computer Science Excellence
0 votes
76 views
Array follows static memory allocation then why it gives garbage value in case of uninitialized array .and it gives zero when the array is partially initialized?
in Programming by (105 points) | 76 views

1 Answer

0 votes
yes array follows static memory allocation means the size equal to the size of array is statically allocated in the memory before accessing it. Uninitialized  array gives garbage value at runtime because it follows the local variable concept when we declare array inside the function.when static specifier is used for array or array is declare outside the function  then it will give 0 at run time(partially initialized array).
by Active (4k points)
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,666 questions
56,167 answers
193,834 comments
93,996 users