Machine-translated by Google. Questions are authored in English.
Top

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;
}

 

  • A.Automatic storage class
  • B.Extern storage class
  • C.Static storage class
  • D.Register storage class

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.