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 is the output of following question? void main() { int i=0,a[3]; a[i]=i++; printf("%d",a[i] }

3 Answers  


Three major criteria of scheduling.

1 Answers  


how can I convert a string to a number?

0 Answers  


What are the three constants used in c?

0 Answers  


Which of the Following will define a type NODE that is a node in a Linked list? A)struct node {NODE*next;int x;};type def struct node NODE; B)typedef struct NODE {struct NODE *next;int x;}; C)typedef struct NODE {NODE *next;int x;}; D)typedef struct {NODE *next;int x;}NODE;

5 Answers   Accenture, TCS,






What is a stream?

0 Answers  


What is memcpy() function?

0 Answers  


write a program that print itself even if the source file is deleted?

2 Answers  


what will be the output for the following main() { printf("hi" "hello"); }

5 Answers   RoboSoft,


What do you mean by a sequential access file?

0 Answers  


Why does not c have an exponentiation operator?

0 Answers  


the question is that what you have been doing all these periods (one year gap)

0 Answers   HCL,


Categories