I am trying to create a program that does some operations on a dynamic string. The next method is supposed to set myString to an empty string.
Whenever I try to realloc() the struct with the string (just like in the line of code which was only added for demonstration purposes) it results in an error:
Heap block at 0000000000541E80 modified at 0000000000541E91 past requested size of 1.
What causes the problem? I started learning C only a few weeks ago, so please don't use advanced terms.
struct _MyString
{
    char* myString;
};
MyString * myStringAlloc()
{
    MyString *newMyString = (MyString*) malloc(0);
    if(newMyString == NULL)
    {
        return NULL;
    }
    newMyString->myString = "";
    newMyString = (MyString*) realloc(newMyString, 4);
    //some more code
    return newMyString;
}
 
    