I have an array of strings and I want to know the length of each of its constituent strings. All the strings are of different lengths but the compiler shows all of them to be of equal size. Anyone can explain why is it happening? Here's the code:
string arr[] = {"ACACACZCZCZC", "LOQWABCB", "PTUTCFEBC"};
int n = sizeof(arr)/sizeof(arr[0]);
cout<<"number of strings is "<<n<<endl;
cout<<"individual size of strings: str1 = "<<sizeof(arr[0])<<", str2 = "<<sizeof(arr[1])<<", str3 = "<<sizeof(arr[2])<<endl;
and this results in size of all strings as 8.