41 - Pointers and Math

2018-01-02  本文已影响0人  社交帐号直接注册
#include <iostream>
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;
}
上一篇 下一篇

猜你喜欢

热点阅读