07指针

作者: LuckTime | 来源:发表于2016-06-18 09:55 被阅读3次

    include <iostream>

    using namespace std;
    /*
    int print(char* p);
    int main()
    {
    int n = 100;
    int* p = &n;
    int** q = &p;
    int*** w = &q;
    cout << "n = " << n<< endl;
    cout << "p = " << p<< endl;
    cout << "
    q = " << q<< endl;
    cout << "
    *w = " << ***w<< endl;

    cout << "*&n - *p = " << &n - p<< endl;

    //a[10]
    int* a = NULL;
    cin >>n;
    a = new int[n];//申请数组
    delete a; //删除 地址指针。

    cout << "a = " << a<< endl; //输出的是a[10]的首地址
    }
    */

    int main()
    {
    char a[20];
    int leng =0;
    int i =0;
    cin >> a;
    while(a[i]!=0)
    {
    if(a[i++] == 'a')
    leng++;
    }
    cout << leng<<endl;
    }

    相关文章

      网友评论

          本文标题:07指针

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