[ create a new paste ] login | about

Link: http://codepad.org/P1WXQlCp    [ raw code | output | fork ]

hmurcia - C++, pasted on Dec 13:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Global and local variables
#include <iostream>
using namespace std;

double a = 128;

int main ()
{
    double a = 256;
    double b=a+a;
    double c=::a+::a;

    cout << "Local a: " << a << endl;
    cout << "Local b: " << b << endl;
    cout << "Global a: " << ::a << endl;
    cout << "Local c: " << c << endl;
    return 0;
}


Output:
1
2
3
4
Local a: 256
Local b: 512
Global a: 128
Local c: 256


Create a new paste based on this one


Comments: