+ 1

Why the use of Global Variables discouraged?

I submitted a program as an assignment in my Data Structures Course, the program was correct but I was not given full score and the teacher said that the reason of deduction of marks is due to usage of Global Variables in my program.

2nd Jun 2019, 10:00 AM
S Shashank
S Shashank - avatar
1 Resposta
+ 3
Because global variables are accessible from entire program and can be changed easily this may cause bugs..... Maybe I am wrong but I thik that is the reason
2nd Jun 2019, 10:09 AM
Bakar Jokhio
Bakar Jokhio - avatar