#include <iostream>

int main()
{
  /* Character arrays and string literals */

  // Declaration of three arrays in the user data area, read and write permissions for the elements:
  char t1[] = {'H','e','l','l','o','\0'};
  char t2[] = "Hello";
  char t3[] = "Hello";

  // Declaration of two pointers in the user data area, read and write permissions for the pointers
  // and allocation of the "Hello" literal (possibly) read-only 
  char *s1 = "Hello";    // s1 points to 'H'
  char *s2 = "Hello";    // s2 likely points to the same place   

  void  *v1 = t1, *v2 = t2, *v3 = t3, *v4 = s1, *v5 = s2;
  std::cout << v1 << '\t' << v2 << '\t' << v3 << '\t' << v4 << '\t' << v5 <<std::endl;
  // the result (v1, v2 v3 are different, v4 and v5 could be the same):
  // 0x23fe10      0x23fe00      0x23fdf0      0x404030       0x404030

  // assignment to array elements:
  *t1 = 'a'; *t2 = 'b'; *t3 = 'c';

  // modifying string literal: could be segmentation error: 
  *s1 = 'd'; *s2 = 'e';

  // The type of "Hello" is const char[6].
  // const char[] --> char* conversion is only for C reverse compatibility
        char *s3 = "Hello";  // warning: deprecated conversion from string constant to 'char*'
  const char *s4 = "Hello";  // correct way, no write permission through the pointer
  *s4 = 'f';  // syntax error, const-correctness is not flawed

  return 0;
}