06/04/2023 7:37 am
Topic starter
Notifications
Clear all
What are static and global variables ?
0
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
- 14 Forums
- 1,837 Topics
- 5,053 Posts
- 0 Online
- 1,079 Members
Our newest member: Tyronenodub
Latest Post: loli
Forum Icons:
Forum contains no unread posts
Forum contains unread posts
Topic Icons:
Not Replied
Replied
Active
Hot
Sticky
Unapproved
Solved
Private
Closed