Opposite to C in C++ string literals have types of constant character arrays. (Though in the both languages you may not change string literals.)
Arrays used in expressions with rare exceptions are converted to pointers to their first elements.
So in this expression statement
Our_String = "This is a string";
the string literal has the type const char [17]
and implicitly is converted to the type const char *
.
However the left operand of the expression with the assignment operator has the type char *
due to this declaration
char* Our_String;
You may not assign a pointer to constant object to a pointer to non-constant object.
Hence you need to rewrite the declaration above like
const char * Our_String;
In this case the both subexpressions of the assignment will have the same type const char *
.
Another approach is to declare an array instead of the pointer and initialize it with the string literal as for example
char Our_String[] = "This is a string";
and then you can output it the same way as you are outputting the pointer
cout << Our_String;