![]() 1.23 The local global_variable inside myFunction2() 10 The global global_variable updated by myFunction() Std::cout << myFunction(10) << std::endl Std::cout << global_variable << std::endl In this case, the local one takes higher priority. local variable but has the same name as the global_variable. update the global variable within a function global variable can be accessed everywhere local variable can only be accessed within block. Int global_variable = 0 // global variable
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |