Difference between static global and global?

Answer Posted / sandeep gautham

a program can be spread across two or more files...
so, a global variable can be accessed by all the files..
where as, a static global variable can be accessed only by
the file in which it is declared...static means permanent
and hence the value in static global variable is shared by
all the functions in that file...

Is This Answer Correct ?    35 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of the "delete" operator?

622


What is the difference between while and do while loop?

550


C is to C++ as 1 is to a) What the heck b) 2 c) 10

634


Can we specify variable field width in a scanf() format string? If possible how?

654


How are pointers type-cast?

639






Explain stack & heap objects?

623


What is the basic structure of c++ program?

563


Is c or c++ more useful?

570


Is swift faster than go?

609


What is difference between n and endl in c++?

582


How would you find out if a linked-list is a cycle or not?

540


How would you differentiate between a pre and post increment operators while overloading?

648


Explain register storage specifier.

586


Can turbo c++ run c program?

624


What is &x in c++?

556