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

Discussion

What is the output of this C code?

void main()
    {
        int x;
    }

here x is a

  • A.automatic variable
  • B.static variable
  • C.global variable
  • D.register variable

Answer: A

Correct answer: automatic variable

x is declared inside a function with no storage class, so it is automatic by default - on the stack, uninitialised, and gone when main returns.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.