Replies
Welcome, guest
Join CrazyEngineers to reply, ask questions, and participate in conversations.
CrazyEngineers powered by Jatra Community Platform
-
@thebigk • Aug 14, 2012
#-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-WEmcz0 • Aug 14, 2012
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?
actually sir i have tried allot but i am not able to understand..
-
@thebigk • Aug 14, 2012
hare singh nayakactually sir i have tried allot but i am not able to understand..
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.
-
@sreejith-t-bGIQl2 • Aug 17, 2012
hare singh nayak hi CEns
could anyone explain in detail of this code.
#include<stdio.h>
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
};
struct yy *q;
};
}hey ... have you compiled this program..... ???? i think it has got some incorrect termination error (i compiled it).... itz not executing..... π
-
@hare-singh-nayak-WEmcz0 • Aug 17, 2012
Sreejith They ... have you compiled this program..... ???? i think it has got some incorrect termination error (i compiled it).... itz not executing..... π
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.
-
@david-emperor-i8PcCa • Aug 17, 2012
I 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-bGIQl2 • Aug 18, 2012
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;hey dude, i think itz a C code π
-
@sreejith-t-bGIQl2 • Aug 18, 2012
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.
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-#
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-e8RF2B • Aug 28, 2012
Hi,I tried this code out in Borland C++ and it didn't show any error. Its just a concept of nested structure.
-
@banashree-patra-m0OJwR • Aug 29, 2012
hare singh nayak hi CEns
could anyone explain in detail of this code.
#include<stdio.h>
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
};
struct yy *q;
};
}Hey @ hare singh nayak if we write the above code as
#include<stdio.h>
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
}*q;
};
}
then it is not giving any error,though both are same. -
@slashfear-tSWzpz • Aug 31, 2012
isn'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-pysGmK • Aug 31, 2012
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-pysGmK • Aug 31, 2012
Banashree PatraHey @ hare singh nayak if we write the above code as
#include<stdio.h>
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
}*q;
};
}
then it is not giving any error,though both are same.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...