Size of string data type in C++ array

  c++, string

This is a very simple code in C++. The address of the strings are separated by a constant gap of 28 bytes. What does these 28 bytes contains. I am trying to find an analogy with the gap of 4 bytes of an array containing integers. As far as I know the 4 bytes ensures that the upper limit of the value of an integer. What happens in case of the 28bytes. Does it really contain 28*8 bits of character data – I do not believe that. I have tried giving in a large text of data, and it still prints without any issues.

    string str[3] = { "a", "b", "c" };
    for (int i = 0; i < 3; ++i) {
        cout << &str[i] << endl;
    }

Source: Windows Questions C++

LEAVE A COMMENT