+9

how does a static variable in c work? What is the advantage of using this variable?

c

2/18/2020 1:58:09 AM

José Cleto

4 Answers

New Answer

+9

Static Variable has a property of preserving their value even after they are out of scope, static variable can preserve its value in their previous scope and can be used again without initialized again. actually static is a key word used for storage classes. Reference: https://www.youth4work.com/Talent/C-Language/Forum/118628-what-is-the-use-of-static-variable-in-c

+3

Static variables are initialized one time only. a static variable can preserve its value in their previous scope and can be used again without initialized again. a static variable is used for a fixed value in your project like college name is same for all page so college name is declared as static.

0