0
What is the scope of a variable declared inside a loop in C ?
4 odpowiedzi
+ 1
Only inside the loop
+ 1
Thomas Williams what if it's a static variable ?
+ 1
Scope of variable can be global or local. In C you can declare variables global and use it in every function of your program or you can declare variables external to your .c file and variable can be in other .c or .h in such case you need to use extern keyword. So now static , static variables can persist value and there scope can be limited to a .c file or a function in which they are declared. I think static variables very useful.
0
Himanshu Kumar Depends on context. I'm not sure you can declare a static variable in a loop