#include
#include
#include
int main()
{
struct emp
{
struct address
{
int a;
The syntax of a structure definition is:
struct identifier {
type member_name;
// ...
};
If you add an identifier just after the closing curly brace, you're declaring a variable with that defined struct.
In your first example the compiler consider the address
struct as member type. it's like if you writes:
struct identifier {
type ; // No member name is specified
type a1;
// ...
}
But in the second example you specified the member name:
struct identifier {
type a1; // Member name specified
// ...
}
And here is an example of the warning: http://ideone.com/KrnYiE.