+ 10

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

18th Feb 2020, 1:58 AM
José Cleto
José Cleto - avatar
4 ответов
+ 10
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
18th Feb 2020, 2:16 AM
BroFar
BroFar - avatar
+ 4
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.
20th Feb 2020, 4:49 AM
Ishan Shah
Ishan Shah - avatar
0
Hauar you
19th Feb 2020, 5:22 AM
Mihushan Mohamed
Mihushan Mohamed - avatar