75.6k views
2 votes
The scope of a variable declared within a for() loop is:

a) Only known within the for() loop

b) Global across all functions in the file containing the code

c) Local to the function containing the for() loop

d) It depends on the variable type

User Employee
by
5.7k points

1 Answer

2 votes

Answer:

a

Step-by-step explanation:

The variable declared in the for is accessible only within the for loop and it goes out of scope once the loop get end

eg : for(int i=1;i<=10,i++) // variable i is declared

{

// variable i is visible only in this block,

}

//After this the variable i goes out of scope

User Bent Cardan
by
6.0k points