[ create a new paste ] login | about

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

johannes - C++, pasted on Nov 2:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

int main()
{
    int n[2];
    n[0] = 4;
    n[1] = 7;

    int (*p)[2] = &n;

    std::cout << (*p)[0] << std::endl;       // 4
    std::cout << (*p)[1] << std::endl;       // 7

    // or...

    std::cout << **p << std::endl;           // 4
    std::cout << *(*p + 1) << std::endl;     // 7

    return 0;
}


Output:
1
2
3
4
4
7
4
7


Create a new paste based on this one


Comments: