c++11 - c++ 14 vs 11 - sizeof return different value? -


for same program c++11 return 2 1 2, c++14 return 2 1 1 me. confused..

#include <iostream> #include <string> using namespace std; int main() {     char a[2];    cout << sizeof(a) << endl;      std::string b("a");    cout << b.size() << endl;      char c[b.size() + 1];    cout << sizeof(c) << endl;     return 0; } 

char c[b.size() + 1]; not allowed in standard c++, version.

if find compiler accepts compiler extension, should consult documentation whichever compiler used.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -