LearnFrenzy
Sign in Take a free test

C Variables · Variables MCQ · Question 2

Value of an uninitialised global variable in C Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 2 Back to Exercise

What is the value of int total; declared outside all functions, before it is assigned?

  • A Garbage
  • B 0 Correct
  • C 1
  • D It does not compile
Correct Answer: Option B

Variables with static storage duration – globals and static locals – are zero-initialised before main() runs (pointers become NULL, doubles 0.0).

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links