I have a problem trying to set a string inside a struct, bellow is my code:
struct movieNode
{
string name;
};
int main()
{
struct movieNode* newMovieNode = (struct movieNode*)malloc(sizeof(movieNode));
newMovieNode->name = "123";
}
When a run this, the following message appears:
"Unhandled exception at 0x5EDB11E2 (msvcr110d.dll) in Trabalho.exe: 0xC0000005: Access violation writing location 0xCDCDCDCD."
Someone can help me fix this?
Thanks a lot.