1.

If a program has 4 functions then will all of them be able to access the data held by a global variable?(a) Yes(b) NoThis question was addressed to me in exam.The question is from Variable Scope and Qualifiers topic in division Arduino Programming of Arduino

Answer»

The correct answer is (a) Yes

Easy explanation: Any GLOBAL variable when defined in a PROGRAM automatically is open for all functions present in the program to access and perform read or WRITE OPERATIONS. On the contrary any variable defined within the SCOPE of a function, will only be able to be accessed within the function itself.



Discussion

No Comment Found

Related InterviewSolutions