I know that for example "hello" is of type const char*. So my questions are:

  1. How can we assign a literal string like "hello" to a non-const char* like this:

    char* s = "hello";  // "hello" is type of const char* and s is char*
                        // and we know that conversion from const char* to
                        // char* is invalid
    
  2. Is a literal string like "hello", which will take memory in all my program, or it's just like temporary variable that will get destroyed when the statement ends?

Edit
Report