Ask Question
27 December, 11:41

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.

+2
Answers (1)
  1. 27 December, 15:34
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers