I was messing around with structs and noticed that of the following two examples, only one worked. Here they are:
struct Test
{
char *name;
int age;
};
Test p1 = { "hi", 5 };
//works
struct Test
{
char *name;
int age;
}p1;
p1 = { "hi", 5 };
//error
How come the first one compiles and the second one doesn't? Isn't p1 an object of Test either way? Thanks.