Difference between static global and global?

Answer Posted / ravi.g

local static variable and global variable both are same
since both can be accessed from all the functions in the
same file in which they declared.

Global variable has the file scope since it can be accessed
from other files also by using extern keyword.

Local static vaeriables have no file scope since they can
not be accessed from other files by any means.

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do class declarations end with a semicolon? Do class method definitions?

611


How does code-bloating occur in c++?

742


When is the destructor called?

601


Why main function is special in c++?

661


How many different levels of pointers are there?

652






Describe new operator?

614


Why do we use templates?

593


Describe the syntax of single inheritance in C++?

641


What is bubble sort c++?

570


What does the linker do?

586


What is the use of data hiding?

590


Can a program run without main in c++?

580


What are mutator methods in c++?

641


Is there finally in c++?

614


What is a class template in c++?

516