when i got a normal struct variable code:
but when my object is a part of an array and i take just one objectCode:struct human {
char name[50];
int age;
float height;
};
struct human TR = {"Tony", 12, 1.5}; \\this works
the same data input method doesnt work
why is that?
Code:#include <stdio.h>
typedef struct robot ROBOT;
struct robot {
char *name;
int energy;
};
int main() {
int i;
ROBOT robots[3];
robots[0] = {"Lunar Lee", 50}; //this dont work