What is the difference between Local & Global Variables?

16. What is the difference between Local & Global Variables?

  1. Variables in an outer block are defined as local variables since they cannot be accessed from the outside whereas the innermost block declares global variables.
  2. Variables in an inner block are defined as global variables since they cannot be accessed from the outside whereas the outermost block declares local variables.
  3. Variables in an outer block are defined as global variables since they can be accessed from the outside and the innermost block also declares global variables.
  4. Variables in an inner block are defined as local variables since they cannot be accessed from the outside whereas the outermost block declares global variables.

Answer: D) Variables in an inner block are defined as local variables since they cannot be accessed from the outside whereas the outermost block declares global variables.

Explanation:

Variables in an inner block are defined as local variables since they cannot be accessed from the outside whereas the outermost block declares global variables.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.