Monday 1 April 2013

Is the following code legal? (5)


    Is the following code legal?

void main()
{
typedef struct a aType;
aType someVariable;
struct a
{
int x;
      aType *b;
              };
}
Answer:
         No
Explanation:
         When the declaration,
typedef struct a aType;
is encountered body of struct a is not known. This is known as ‘incomplete types’.

Blog Author: Vijay Kumar

No comments:

Post a Comment