samedi 4 décembre 2021

Same value every time when want to get size of array [duplicate]

I am new to c++, so please do not judge me strictly. I am trying to get size of array, but this code sample always returns 2. Also I can use only C++11. What is the problem and how can I deal with it? Thank you in advance.

String string = "paris";
char * array = new char [string.length() + 1];
int arraySize = sizeof(array) / sizeof(array[0]);

Aucun commentaire:

Enregistrer un commentaire