+ 1

Language C. If a global variable is also static, can it be modified by other program functions?

Global variabile

10th Sep 2019, 8:31 AM
Ruggero Quaglia
Ruggero Quaglia - avatar
14 Respostas
+ 4
yes it can be modified
12th Sep 2019, 8:16 AM
Md Shadab Alam
Md Shadab Alam - avatar
+ 3
If you have large project, involving multiple source files (i. e. *.h,*.c). Then we can have global static variables. So, that they are accessible to all functions in the same file only. Outside the file, global static variables are not visible.
10th Sep 2019, 8:47 AM
Kuri
Kuri - avatar
+ 2
Yeah yeah. but the question is "can they be modified by functions?"
10th Sep 2019, 8:53 AM
Ruggero Quaglia
Ruggero Quaglia - avatar
+ 2
yeah, can be modify in multiple functions
10th Sep 2019, 8:54 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 2
maybe you should try it out in a code instead of asking
10th Sep 2019, 8:56 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 2
there is no theory in programming because you need to be sure, you need to write everthing and test it against all odds
10th Sep 2019, 8:59 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 2
I mean that before answering it is necessary that the answer is correct.
10th Sep 2019, 9:02 AM
Ruggero Quaglia
Ruggero Quaglia - avatar
+ 2
I'm sorry, but I didn't study psychiatry.
10th Sep 2019, 9:10 AM
Ruggero Quaglia
Ruggero Quaglia - avatar
+ 1
global variable are not static, the exist all through the existent of the code, unlike static only exist in its defined function
10th Sep 2019, 8:32 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 1
I have serious doubts about your answers.
10th Sep 2019, 8:55 AM
Ruggero Quaglia
Ruggero Quaglia - avatar
+ 1
maybe I'm learning the theory first, at least that's important to know before answering questions incorrectly
10th Sep 2019, 8:59 AM
Ruggero Quaglia
Ruggero Quaglia - avatar
+ 1
what do you mean Ruggero Quaglia ???
10th Sep 2019, 9:00 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 1
if you think my answer is wrong am fine with that
10th Sep 2019, 9:04 AM
✳AsterisK✳
✳AsterisK✳ - avatar
0
no friend, the global are static. the local are automatic.
10th Sep 2019, 8:34 AM
Ruggero Quaglia
Ruggero Quaglia - avatar