41 - Pointers and Math

#include 
using namespace std;

int main()
{
    int bucky[5];
    int *bp0 = &bucky[0];
    int *bp1 = &bucky[1];
    int *bp2 = &bucky[2];

    cout << "bp0 is at" << bp0 << endl;
    cout << "bp0 is at" << bp1 << endl;
    cout << "bp0 is at" << bp2 << endl;

    bp0 += 2;
    cout << "bp0 is now at" << bp0 << endl;
    bp0 ++;
    cout << "bp0 is now at" << bp0 << endl;
}

你可能感兴趣的:(41 - Pointers and Math)