Ask Question

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

+4
Answers (1)
  1. 4 July, 09:00
    0
    a

    Explanation:

    The scope of a variable declared within the for () loop is only known within the for loop.

    The variable declared within the for () loop is accessible inside the loop itself and it goes out of scope once it comes out of the loop.

    for (int i=1; i<=10; i++) / / variable i is declared inside the loop

    {

    / / variable i is accessible inside this block only

    }

    / / variable i goes out of scope
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “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 ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers