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.
6/2/2019 10:00:26 AM
S Shashank2 Answers
New AnswerCoder San 1. Accidental modification by function since they are accessible to all 2. Consume memory - since they remain in memory throughout the lifetime of program. 3. By defailt have external linkage, which implies they visible across all translation units, and can cause name conflict.
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
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message