C++ examples for Function:Global Variable
Create An Unsigned Integer Global Variable
#include <iostream> using namespace std; unsigned int counter{ 0 }; void IncreaseCounter() { counter += 10;//w ww .ja va2s. c o m cout << "counter is " << counter << endl; } int main(int argc, char* argv[]) { counter += 5; cout << "counter is " << counter << endl; IncreaseCounter(); return 0; }