205k views
3 votes
The scope of a variable declared outside of any function is:

a) Global

b) Local

c) Within that file only

User Rinux
by
5.9k points

1 Answer

6 votes

Answer:

The correct answer for the given question is option(A) i.e Global

Step-by-step explanation:

The global variable is the variable which is declared outside the function The lifetime and scope of global variable in whole the program i.e "Globally" .They can be access anywhere in the program,however local variable are those which is declared inside the function .local variable are access inside that function only where it is declared.

Following are the example of Global variable.

#include <stdio.h> // header file

int t=9;// global variable declared outside the function

int main() // main function()

{

printf("%d",t); // display the value of t

return 0;

}

so the correct answer is Global.

User Spacetyper
by
5.3k points