'return fields of a structure from a function in C [duplicate]
I have following structure in C and trying to assign a string into title field of menuButtons structure. But I getting an error:
Error C2440 "=": unable to convert from "const char [6]" to "char *"
struct menuButtons {
int xTopLeft;
int yTopLeft;
int xBottomRight;
int yBottomRight;
char *title;
} easy, medium, hard;
struct menuButtons getEasyInfo() {
easy.xTopLeft = 190;
easy.yTopLeft = 200;
easy.xBottomRight = 450;
easy.yBottomRight = 280;
easy.title = "EASY MODE"; --> error
return easy;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
