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

Short Answer
Views 4179

Answer:

  • 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.

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of C Programming Language, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.