zoukankan      html  css  js  c++  java
  • 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;
    }
    
    
  • 相关阅读:
    [SNOI2019]数论
    [HNOI2019]校园旅行
    [TJOI2019]唱、跳、rap和篮球
    [Ctsc2015]misc
    [IOI2018] meetings 会议
    [ZJOI2019]语言
    51nod1600 Simple KMP
    [APIO2013]道路费用
    [FJOI2018]领导集团问题
    [ZJOI2012]小蓝的好友
  • 原文地址:https://www.cnblogs.com/hugeng007/p/9320891.html
Copyright © 2011-2022 走看看