Find Error if any in below code, Justify ur answer:

struct xx
{
int a;
struct yy
{
char c;
struct xx* p;
}
struct yy* q;
}

Answers were Sorted based on User's Feedback



Find Error if any in below code, Justify ur answer: struct xx { int a; struct yy { ..

Answer / vignesh1988i

here the error is the variable declaration of struct xx is not permitted inside struct yy. since this is nested structures ,so according to the braces for each structures the variables for that particular structure should be assigned (OR)
if this is written as code given below this will be correct.
THIS IS THE CORRECT CODE WHICH WILL GIVE NO ERROR.
struct xx
{
int a;
}
struct yy
{
char c;
struct xx *p;
}
struct yy *q

THE SAME CODE GIVEN IN THE QUESTION CAN BE CORRECTED AS :

struct xx
{
int a;
struct yy
{
char c;
}*q // for struct yy
}*p // for struct xx


thank u

Is This Answer Correct ?    4 Yes 1 No

Find Error if any in below code, Justify ur answer: struct xx { int a; struct yy { ..

Answer / raj

struct xx
{
int a;
struct yy
{
char c;
struct xx* p;
};//Semicolon is missing
struct yy* q;
}

Is This Answer Correct ?    0 Yes 4 No

Find Error if any in below code, Justify ur answer: struct xx { int a; struct yy { ..

Answer / lucky

threr is no error in this prg

Is This Answer Correct ?    0 Yes 5 No

Post New Answer

More C Interview Questions

int main(){ float f=8.0; if(f==8.0) printf("good"); else printf("bad"); } what is the answere and explain it?

3 Answers  


Where are the auto variables stored?

0 Answers   TISL,


What is character set?

0 Answers  


What is indirection?

0 Answers  


wat is the difference between a definition and declaration? float y;---it looks like a declaration..but it s a definition.how?someone explain

3 Answers   TCS,






what is the differance between pass by reference and pass by value.

7 Answers   Infosys,


can u give me the good and very optimised code for a car racing game?

0 Answers  


Write a program to print this triangle: * ** * **** * ****** * ******** * ********** Don't use printf statements;use two nested loops instead. you will have to use braces around the body of the outer loop if it contains multiple statements.

6 Answers   Wipro,


What are the disadvantages of a shell structure?

0 Answers  


What is use of bit field?

0 Answers  


code for replace tabs with equivalent number of blanks

0 Answers   Bosch,


Explain continue keyword in c

0 Answers  


Categories