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

WRITE A PROGRAM IN C TO MULTIPLY TWO 2-D ARRAYS

4 Answers  


Program to find larger of the two numbers without using if-else,while,for,switch

11 Answers   iNautix, Wipro,


how to copy a string without using c function

5 Answers  


how to add two numbers without using arithmetic operators?

4 Answers  


Can anyone help me with this please? Need to print the below values.. Thanks 1 1 2 1 2 3 1 2 3 4

3 Answers  






int far *near * p; means

0 Answers   Honeywell,


C language questions for civil engineering

0 Answers   Tech Mahindra,


write a program to count the no of repaeted words in a line?

1 Answers  


write a c program to find reminder and quotient if one number is divided by other.to code this program don't use more than 2 variables

2 Answers   TCS,


Write a c program to sort six numbers and find the largest one by using the ladder of if-else? plz do help me

2 Answers  


what do structure language means?

3 Answers   Microsoft,


2. Write a function called hms_to_secs() that takes three int values—for hours, minutes, and seconds—as arguments, and returns the equivalent time in seconds.. Create a program that exercises this function by repeatedly obtaining a time value in hours, minutes, and seconds from the user (format 12:59:59), calling the function, and displaying the value of seconds it returns.

3 Answers   TCS,






Categories