What values are automatically assigned to those array elements which are not explicitly initialized?
Answers
Answered by
3
Answer:
In C, if an object that has static storage duration is not initialized explicitly, then:
— if it has pointer type, it is initialized to a NULL pointer;
— if it has arithmetic type, it is initialized to (positive or unsigned) zero;
— if it is an aggregate, every member is initialized (recursively) according to these rules;
— if it is a union, the first named member is initialized (recursively) according to these rules.
For example, following program prints:
Value of g = 0
Value of sg = 0
Value of s = 0
Similar questions
Math,
19 days ago
Math,
19 days ago
India Languages,
1 month ago
English,
1 month ago
English,
9 months ago