Look the following code:

struct emp
{
       CASE :1
        struct emp p;  //ERROR 
       CASE :2
        struct emp *k; //IT WILL WORK
};

WHY IT IS WORKING IN CASE :2 and not in CASE :2.
TELL me with explanation

Because in the first case the structure would be infinitely large. You are saying "emp is composed of an emp and some other stuff." well, what's in the emp inside the emp? Why another emp of course! And so on.

The second case you are saying the emp containst a POINTER to another emp. A pointer is fixed in size and isn't the emp itself, just the pointer to it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.