Can you please explain, why this program works:
#include<stdio.h>
int main()
{
struct first{
char *name;
int a;
};
struct second{
struct first *second;
int z;
};
struct first *FIRST, C;
FIRST = &C;
struct second *SECOND, b;
SECOND = &b;
SECOND->second->a = 9;
printf("%d", SECOND->second->a);
return 0;
}
while this doesn't:
#include<stdio.h>
int main()
{
struct first{
char *name;
int a;
};
struct second{
struct first *second;
int z;
};
//struct first *FIRST, C;
//FIRST = &C;
struct second *SECOND, b;
SECOND = &b;
SECOND->second->a = 9;
printf("%d", SECOND->second->a);
return 0;
}
In short, can you please tell me why do I need to add those two commented-out lines in the code above? I am a beginner in this field. So, it would be very kind of you if you help me.
Thanks in advance!