2.3k views
5 votes
The scope of a variable declared inside of a function is:

a) Local - within that function

b) Within that file only

c) global

User Vytautas
by
7.8k points

1 Answer

3 votes

Answer:

a

Step-by-step explanation:

The variable declared is local within that function that is the declared variable is accessible inside that block itself, it cannot be accessible outside the given function.

ex - void add()

{

int a=10, b=20 , c ;

c = a + b ;

cout << c ;

}

int main()

{

cout << "value for c is :"<< c ;

return 0;

}

Here inside the add function variable a, b,c are declared and initialized inside the function.

User Wassim Benhamida
by
7.1k points