Why doesn't this code work? Is it because I have to allocate memory for char* tool_tip_text and how would I do that?
I've tried allocating memory using this, but it doesn't help either.
button->tool_tip_text = malloc(sizeof(char) * strlen(text)+1)
Code:typedef struct { char* tool_tip_text; }BUTTON; int create_button(BUTTON* button, char* text) { printf("%d",strlen(text)); strcpy(button->tool_tip_text,text); return 0; } create_button(&my_button[0],"New Level");