Sizeof(char array) v/s sizeof(string)

when i run the following code
https://ide.codingblocks.com/s/49811
i get output as 8, 32 respectively, i woulld like to know why this is happening as both are one and the same thing i guess char a[]=“amazing” and string s=“amazing”
what is the difference b/w these two

Hy Aayush, sizeof(std::string) gives you the size of the class instance and its data members, not the length of the string.

Hey Aayush, I am marking your doubt as Resolved for now. Re-open it if required.