Computer Science, asked by Harshit3176, 1 year ago

A variable which is visible only in the function in which it is defined, is called

Answers

Answered by VemugantiRahul
8
A 'Local variable' is a variable which is visible only in the function in which it is defined
:)
hope it helps
Answered by arshaarunsl
0

Answer:

Local Variables are only visible within the scope of the function in which they are defined.

Explanation:

Definition:

  • A local variable is a variable whose scope and range are limited to the method or statement block in which it is declared.
  • It's used in the foreach statement as an iteration variable, in the specific-catch clause as an exception variable, and in the using statement as a resource variable.

Example:

For instance, for(int i=0;i=5;i++) In the example above, int i=0 is a declaration of a local variable. The for loop is the only thing it can do.

Visibility of the variables:

  • The way a variable is accessed within a programme determines its visibility. Within its scope, a variable is visible; but, outside of its scope, it is concealed.
  • The visibility of a variable determines how much of the rest of the programme can access it.

#SPJ3

Similar questions