What is ** in C++?

后端 未结 11 1267
野性不改
野性不改 2020-12-04 14:24

I\'ve seen some code, as well as some errors generated from my compiler that have a \'**\' token before the variable (eg **variablename unreferenced-- or someth

11条回答
  •  旧巷少年郎
    2020-12-04 15:06

    You may recognize the signature for main():

    int main(int argc, char* argv[])
    

    The following is equivalent:

    int main(int argc, char** argv)
    

    In this case, argv is a pointer to an array of char*.

    In C, the index operator [] is just another way of performing pointer arithmetic. For example,

    foo[i]
    

    produces the same code as

    *(foo + i)
    

提交回复
热议问题