
Notifications
Clear all
What are static and global variables ?
0
06/04/2023 7:37 am
Topic starter

are they the same ? elaborate please.
Answer
Add a comment
Add a comment
1 Answer
0
06/04/2023 9:51 am
Global variables: Variables declared as static at the top level of a source file (outside any function definitions) are only visible throughout that file.
Static local variables: Variables declared as static inside a function are statically allocated, thereby keeping their memory cell throughout all program execution, while also having the same scope of visibility as automatic local variables. Hence whatever values the function puts into its static local variables during one call will remain the same whenever the function is called again.
Add a comment
Add a comment
Forum Information
- 22 Forums
- 1,969 Topics
- 5,307 Posts
- 0 Online
- 1,282 Members
Our newest member: TimothySenue
Latest Post: Space bug using " & n b s p ; "
Forum Icons:
Forum contains no unread posts
Forum contains unread posts
Topic Icons:
Not Replied
Replied
Active
Hot
Sticky
Unapproved
Solved
Private
Closed