Declaring inner structure variable in nested structure without referring outer structure

I was creating a simple nested structure to get aware about it’s functioning process.Here is the example:

struct Employee
   char ename[20];
   int ssn;
   float salary;
   struct date
       int date;
       int month;
       int year; 

in this case if i want to access members of inner structure i need to do something like = 10;

but in above structure if i omit the variable declaration of structure date i.e doj and try to declare it separately it did not require any reference to emp1 i.e

struct date doj;

The compiler did not give any error in this case. I can also access members of structure date without any reference to emp1 like =15;

I just want to know that how is this possible?

Source: c#

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.