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

What are the different file extensions involved when programming in C?

0 Answers  


How to print "Hi World" without using semi colon?

6 Answers   Infosys,


What tq means in chat?

0 Answers  


What are c identifiers?

0 Answers  


Are local variables initialized to zero by default in c?

0 Answers  






What are dynamically linked and statically linked libraries?

2 Answers  


what is the function of .h in #include<stdio.h> in c ?

23 Answers   HCL, IBM, Wipro,


Explain what is the benefit of using const for declaring constants?

0 Answers  


simple program for virtual function?

1 Answers  


Can we use any name in place of argv and argc as command line arguments?

0 Answers  


a value that does not change during program execution a) variabe b) argument c) parameter d) none

0 Answers  


If the size of int data type is two bytes, what is the range of signed int data type?

0 Answers  


Categories