The conversation between human and AI assistant.
What is the difference between a static variable and global variable in C/C++?
Can a static variable and a global variable have the same name?
Yes, they can have the same name, but they would refer to different variables. The global variable would be accessible from any function in the program, while the static variable would only be accessible within the function in which it is declared.