94.3k views
1 vote
A ________ variable is declared outside all functions.

A) local
B) global
C) floating-point
D) counter
E) None of these

1 Answer

5 votes

Final answer:

A global variable is declared outside all functions and can be accessed by any part of the program, unlike a local variable which is limited to the function's scope.

Step-by-step explanation:

A global variable is declared outside all functions. When you declare a variable outside of any function, it can be accessed and modified by any part of the program, which makes it global in scope.

This contrasts with a local variable, which is declared within a function and can only be accessed within that function's scope.

A floating-point variable refers to the type of variable that can hold decimal values, whereas a counter is often used to refer to a variable used for counting iterations, typically in a loop. Therefore, the correct option is B) global.

User Svyatoslav
by
8.4k points