Scope resolution in c++

Program to show Scope resolution

#include<iostream>

using namespace std;

int m=20;

main()
{
    int m=10;
    {
        cout<<"\nm="<<m;
        int m=200;
        cout<<"\nm="<<m;
        m=5;
    }
    cout<<"\nm="<<m;

    cout<<"\n::m="<<::m;
}
/*
output:
m=10
m=200
m=10
::m=20
*/

Post a Comment

0 Comments