Q:

Ways of initialising a string in c++

what is the difference between initializing the string in the following ways?
string s = "Hello World";

and 
string s[] = {"Hello World"};

From what i understand the former is a class? And the latter an array? Moreover, are there any other ways apart from these two?

A:

In the first example, you define one object of class string.
In the second, you declare an array of strings of undefined length (computed by compiler, based on how many objects you define in the initializer list) and you initialize one string object with "Hello World." So You create an array of size 1.
string s = "Hello World";
string s2[] = {"Hello World"};

After this, s and s2[0] contains strings with identical characters in them.

