I am getting an error while assigning a character array in my object. How can I resolve this error?
typedef struct car {
int id;
char *name;
int price;
char *colors[5];
} car;
int main()
{
car obj;
obj.id = 5;
obj.name = "honda city zx";
obj.price = 1500;
obj.colors = {"red", "blue", "black"}; // Line 17
return 0;
}
Error :
prtemp.c: In function ‘main’:
prtemp.c:17:18: error: expected expression before ‘{’ token
obj.colors = {"red", "blue", "black"};