Create An Unsigned Integer Global Variable - C++ Function

C++ examples for Function:Global Variable

Description

Create An Unsigned Integer Global Variable

Demo Code

#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;
}

Result


Related Tutorials