• pointer1


    The Unknown Word

    The First The Second
    videoinput library 视频输入库
    crocodil ['kra:kedail]鳄鱼
    preprocessor 预处理器 [pri:'prousese(r)]
    novice ['na:vis]初学者,新手,
    intimidate 恐吓,威胁[in'timideit]
    declaration [dekle'reition]声明,宣言
    used [ju:st]习惯于
    SDK software development kit 软件开发工具
    version selector 版本选择器
    xproj 新一代的项目文件,是XML的格式

    Arguments to main

    Arguments is often a novice programmers' first encounter with pointers to array to pointers and can prove intimidating.

    • argv is used to refer to an array of strings,its declaration will look like this:
    char*argv[]	//equivalent to to that show above:char **argv
    int main(int argc,char *argv[])		//int main(int argc,char **argv)
    

    p++、(p)++、++p、++p ——the difference

    int a[5]={1,2,3,4,5};
    int *p = a;

    • *p++ Firstly,get the value to which p ponints(The first element p points to),and increase the pointer p by 1.
            cout << *p++; // the result is 1
    
            cout <<(*p++);  // the result is 1
    
    • (*p)++ Firstly,get the value the pointer p points to(the first element of the array),and increase the value by 1(the first element of array is 2).
            cout << (*p)++; //  1
            cout <<((*p)++);  //2
    
    • *++p Firstly,increase the pointer p by 1(At this point,point to the second element of the array),and the operator * gets the value.
            cout << *++p; //  2
            cout <<(*++p)  //2
    
    • ++*p get the value pointer p points to(the first element of the array),and the value increase by 1(the element become 2).
          cout <<++*p; //   2    
            cout <<(++*p)  //2
    

    #include<iostream>
    int main(){
    int a[5]={1,2,3,4,5};
    int *p=a;
    cout<<p<<endl;
    cout<<*p++<<endl;
    cout<<(*p++)<<endl;
    return 0;
    }
    
    
  • 相关阅读:
    事务一致性
    面试汇总
    什么是时间复杂度?
    语言为什么都要实例化后才能用 ?实例化后这里东西是放在堆里面还是栈里面?
    LRU 算法——简单的淘汰算法
    Redis为什么可以做到10万的QPS?
    Redis基础
    Redis基于Set如何实现用户关注模型?
    资深技术Leader曹乐:如何成为技术大牛
    对MySQL查询结果进行替换
  • 原文地址:https://www.cnblogs.com/hugeng007/p/9320891.html
Copyright © 2020-2023  润新知