Program throw runtime error when i assign value to a char pointer after allocating dynamic memory? : I want to change the contents of the char pointer after allocating dynamic memory, is it possible ? if not, why? My program throws runtime error.
  

    #include <stdio.h>
    
    int main()
    {
    char * str = (char *) malloc (10 * sizeof(char));
    str = "Hello";
    str[2] = 'L'; // here the program throws run time error
    printf("%s",str);
     return 0;
    }