Discussion
What will be the storage class of variable I in the code written below?
#include <stdio.h>
int main()
{
int i = 10;
printf("%d", i);
return 0;
}
Answer: A
Correct answer: Automatic storage class
A variable declared inside a function with no storage class specifier defaults to auto: it is created on the stack when the block is entered, holds junk unless initialised, and is destroyed on exit. The keyword auto itself is almost never written, precisely because it is the default.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development