Ask Question
7 December, 21:32

Which of the following statements about global variables is true? 1. A global variable is accessible only to the main function. 2. A global variable is declared in the highest-level block in which it is used. 3. A global variable can have the same name as a variable that is declared locally within a function. 4. If a function contains a local variable with the same name as a global variable, the global variable's name takes precedence within the function.

+1
Answers (1)
  1. 7 December, 21:53
    0
    A global variable can have the same name as a variable that is declared locally within the function.

    Explanation:

    In computer program, we refer to a global variable as that variable that comes with a global perspective and scope, ensuring its visibility throughout the program, except it is shadowed. The set of this kind of variable is referred to as global state or global environment. One feature of global environment is that it can have similar name as a variable declared locally within the function.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Which of the following statements about global variables is true? 1. A global variable is accessible only to the main function. 2. A global ...” 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