Defining global variables
-
Hello, I had some doubt regarding definition of global variables. If I have to define two global variables with the same name in two cpp files then is it somehow possible to do so..? However I am aware of providing a definition in one file and declaring in other for usage(using extern keyword). Example: int i; should be "defined" in CPP1.cpp and CPP2.cpp belonging to the same project. Regards, Abhishek. Learning is a never ending process of Life.
-
Hello, I had some doubt regarding definition of global variables. If I have to define two global variables with the same name in two cpp files then is it somehow possible to do so..? However I am aware of providing a definition in one file and declaring in other for usage(using extern keyword). Example: int i; should be "defined" in CPP1.cpp and CPP2.cpp belonging to the same project. Regards, Abhishek. Learning is a never ending process of Life.
Global variables are only visible in 1 cpp -------------------------------- Human stupidity is infinite.
-
Hello, I had some doubt regarding definition of global variables. If I have to define two global variables with the same name in two cpp files then is it somehow possible to do so..? However I am aware of providing a definition in one file and declaring in other for usage(using extern keyword). Example: int i; should be "defined" in CPP1.cpp and CPP2.cpp belonging to the same project. Regards, Abhishek. Learning is a never ending process of Life.