746 views
0 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 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.
Position:
Show:

Related questions

1 1 vote
1 1 answer
297
297 views
khanshahima4 asked Sep 24
297 views
1. If precedence tells me which operator has priority, and associativity tells me how to handle operators at the same level, then why do I need a separate concept called ...
0 0 votes
0 0 answers
475
475 views
lalitver10 asked Aug 14, 2024
475 views
#include <stdio.h>int main(){ int x = 3; int z = (++x)+ (x = 10); printf("%d", z); return 0;} 
1 1 vote
1 1 answer
621
621 views
jugnu1337 asked May 10, 2022
621 views
SOURCE NAME::: UNDERSTANDING POINTER IN C (BOOK) BY YASHWANT KANETKARmy answer is C am i right?
0 0 votes
0 0 answers
1.2k
1.2k views
Pawan Nirpal asked Oct 29, 2021
1,242 views
Operator precedence rule for prefix and postfix ++For C programming is the above mentioned article considered as standard, Is there any standard compiler or C standard th...