wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

If initialization is a part of declaration of a structure, then the storage class can be

A
automatic
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
register
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
static
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
anything
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is D static

If initialization is a part of declaration of a structure, then the storage class can be static.

Storage class in C decides the part of storage to allocate memory for a variable; it also determines the scope of a variable. All variables defined in a C program get some physical location in memory where variable's value is stored. Memory and CPU registers are types of memory locations where a variable's value can be stored.

The static specifier gives the declared variable static storage class. Static variable can be used within function or file. Unlike global variables, static variables are not visible outside their function or file, but they maintain their values between calls. The static specifier has different effects upon local and global variables. A static local variable exists only inside a function where it is declared but its lifetime starts when the function is called and ends only when the program ends.

Static' variables are by default initialized with value 0.


flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Simple Interest
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon