333 views
0 votes
0 votes
array data is allocated in static instead of which it will give garbage value when the array is uninitialize .

why??????????????????????????

2 Answers

2 votes
2 votes
Array is allocated memory like any other scalar type. If it is declared in global scope or with static keyword, it gets initialized to 0 as this happens only once in the program. If array is declared in local scope, its memory is allocated in local stack, and there is no implicit initialization as that would cause overhead for function calls.

Related questions

1 votes
1 votes
1 answer
1
jugnu1337 asked May 10, 2022
260 views
SOURCE NAME::: UNDERSTANDING POINTER IN C (BOOK) BY YASHWANT KANETKARmy answer is C am i right?
0 votes
0 votes
0 answers
4