+ 1

What the static keyword does?

Variables or functions declared in the global scope with the static keyword is not accessible to other files of the project. 1. What does the static keyword do with the local variable? The code bellow shows that a local variable with or without the static keyword can be accessible outside the function. 2. Why the address of the var declared with static is quite different? 3. Why int* foo() {int x=0; return &x} always return null pointer? https://code.sololearn.com/c5bJ9LsG2vc6/?ref=app

21st Jan 2020, 9:34 AM
Mahmud Nabil
Mahmud Nabil - avatar
1 Odpowiedź