Ask Question
25 June, 02:35

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.

+4
Answers (1)
  1. 25 June, 03:29
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers