Home / Questions / What is the difference between auto variable and static variable in C?
Explanatory Question

What is the difference between auto variable and static variable in C?

👁 4,249 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

  • Both auto and static variables are local variables.
  • Static variables can retain the value of the variable between different function calls.
  • But, scope of auto variable is within the function only. It can’t retain the value of the variable between different function calls.