美文网首页
41 - Pointers and Math

41 - Pointers and Math

作者: 社交帐号直接注册 | 来源:发表于2018-01-02 10:22 被阅读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;
    }
    

    相关文章

      网友评论

          本文标题:41 - Pointers and Math

          本文链接:https://www.haomeiwen.com/subject/lslfnxtx.html