What is out put of this program ?
hi CEns
could anyone explain in detail of this code.
#include
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
};
struct yy *q;
};
}
could anyone explain in detail of this code.
#include
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
};
struct yy *q;
};
}
Replies
-
Kaustubh Katdare#-Link-Snipped-# : Why not post an analyses on your own first? Ask others to correct you ๐ That'd be a better approach. What say?
-
hare singh nayak
actually sir i have tried allot but i am not able to understand..The_Big_K#-Link-Snipped-# : Why not post an analyses on your own first? Ask others to correct you ๐ That'd be a better approach. What say? -
Kaustubh Katdare
Don't worry about being 'right'. Just go step by step and share your thoughts. That'd be a better way to attack such problems. People will appreciate if you put some efforts and share them with us.hare singh nayakactually sir i have tried allot but i am not able to understand.. -
Sreejith T
hey ... have you compiled this program..... ???? i think it has got some incorrect termination error (i compiled it).... itz not executing..... ๐hare singh nayakhi CEns
could anyone explain in detail of this code.
#include
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
};
struct yy *q;
};
} -
hare singh nayak
yea i have compiled this code and there is compilation error but i want to know why compilation error is there and what is wrong in it.Sreejith They ... have you compiled this program..... ???? i think it has got some incorrect termination error (i compiled it).... itz not executing..... ๐ -
David EmperorI want to know, is it a C++ code
if it is
you used a function which doesn't return a parameter
instead of main() you must use void main()
or int main() and before last } write return 0; -
Sreejith T
hey dude, i think itz a C code ๐David EmperorI want to know, is it a C++ code
if it is
you used a function which doesn't return a parameter
instead of main() you must use void main()
or int main() and before last } write return 0; -
Sreejith T
Hey ... i think u have to declare a structure variable for 'struct xx' and have to point the pointer *p to the structure variable of 'xx' structure .... just check : #-Link-Snipped-#hare singh nayakyea i have compiled this code and there is compilation error but i want to know why compilation error is there and what is wrong in it.
prog no. 5.2
if u declare an object to both the structures xx and yy, then the error message would be cleared ... but the pgm shows no output coz the pointers just point to the structure and nothing else wud happen .... i think it wud work only this manner ... plz consider others also .. coz im only a 2nd year b.tech CSE student .... ๐ ๐ -
Priya NadkarniHi,I tried this code out in Borland C++ and it didn't show any error. Its just a concept of nested structure.
-
Banashree Patra
Hey @ hare singh nayak if we write the above code ashare singh nayakhi CEns
could anyone explain in detail of this code.
#include
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
};
struct yy *q;
};
}
#include
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
}*q;
};
}
then it is not giving any error,though both are same. -
slashfearisn't this a nested struct...? first you have defined an struct named xx then with in that you have defined another struct named yy which has a reference to (pointer) to struct xx...! I believe it should cause an compilation error as the struct xx was not defined at all but used .....
NOTE: I have not complied the code but answered with my understanding....
-Arvind -
Vishal Sharma
struct xx was not defined at all but used .....
what do you mean by defining the struct? Are you telling that the definition must be done globally??
Well, If you mean that, it doesn't matter if you declare it globally or declare it inside a function (main here) it does the same work. The only difference is, its life is within the block of declaration. -
Vishal Sharma
How about writing a few more statements and check the answer? i mean declare the struct variables, allow 'em to go through several calculations, check whether you got the desired output or not...Banashree PatraHey @ hare singh nayak if we write the above code as
#include
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
}*q;
};
}
then it is not giving any error,though both are same.
You are reading an archived discussion.
Related Posts
please suggest me some topics for ppt.
Should me mechanical related.
This is the most intriguing question i've ever had in my mind(along with some other...)..! So do aliens really exist?
One side, there's the phenomenal Stephen Hawking emphasizing that they...
Hey, m juhi.. joint this site coz since few days i've been visiting it daily, M a student of MCA, bt couldnt find that option in the login process.. I...
comparative study of heat transfer to viscoelastic fluids and water in a shell-and-tube heat exchang
hello, I am student of M.tech.
I want some information about viscoelastic fluid for my project work.
Q.1- Is oil a viscoelastic fluid?
Q.2- Give me information about the other...
Most of you must be aware that while water, is moved about by centrifugal pumps, (dynamic type), oil is moved about by gear, gerotor, or anyother positive displacement type of...