#include<stdio.h>
main()
{ struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
};
struct yy *q;
};
}
well i was able to give the answer correctly...ie it has an error...but my explanation for supporting my answer was not correct...
i gave my explanation as
Explanation:
cannot use struct xx before defining it completely..
whereas correct explanation is given as
Explanation:
in the end of nested structure yy a member have to be declared.
can anyone explain me the correct explanation and flaw in what i said...
First of all the code outputs nothing. There is no any output operator in the code.
Secondly definitions of the both structure, outer and inner, are correct. So the code shall be compiled.
The only error is that function main shall have return type int specified explicitly.:)
Could you say what is the year now? And what is the current C++ Standard? And what C++ Standard was before the current?
So I state where you may be wrong, and you turn around by questioning my intelligence? Alright then. ASFAIK, the implicit return has never been taken out of the standard.
Ah see there's the issue. I thought you were saying you must explicitly write the return statement (as OP did not do this), not the return type of the function itself. If you would have actually read my original post, you would have seen this miscommunication and not made a big deal of it.