scope variables local following code compile output actually scope compiles however variables variable global guide generate output following variable local programming scope block variables program language variables variables variable local global difference between variables variables tutorialbrain embedded structure examples variable basics beginners program local programming variables initialize variables variable class declare global codecademy variable global local difference between initialized object language global variables scope local compiles code scope local variables code variable scope variables global local function declaration examples programming java code types constants example within main cpp program data geeksforgeeks variable local global example namespaces tutorial using namespace nested referred anywhere variables programming variables fig example global location local guide output example following check