Is it possible to dynamically create an array of constant size in C++?

后端 未结 4 1082

First of all, I want to reassure you all that I am asking this question out of curiosity. I mean, don\'t tell me that if I need this then my design has problems because I do

4条回答
  •  眼角桃花
    2020-12-06 05:27

    You just do

    int *p = new unsigned int [3]
    

    You can then use *p as a pointer or an array i.e. *(p+1) or p[1]

提交回复
热议问题