Home »

In C, what is the difference between a static variable and global variable?

Question ListCategory: cIn C, what is the difference between a static variable and global variable?
jully882 author asked 8 years ago
1 Answers
ethanbrown author answered 8 years ago

A static variable declared outside of any function is accessible only to all the functions
defined in the same file (as the static variable). However, a global variable can be accessed

by any function (including the ones from different files).

Please login or Register to Submit Answer