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

True or false: If you continuously increment a variable, it will become negative? 1) True 2) False 3) It depends on the variable type

7 Answers  


write a c program to remove all the duplicate characters in a string and replace with single character? ex:-input- AAABBBCCC output- ABC

2 Answers   HCL,


what is the difference between entry control and exit control statement?

12 Answers   Darbari Lal DAV Model School,


Define a structure to store the record of library. The record must consist of at least following fields: Title, Author, Edition, Price, Publisher, and Category. -Define functions authorSearch ( ), TitleSearch ( ) and CategorySearch ( ) to search a book with respect to author, title and category. [There can be more than one book, written by one author, in one category]

2 Answers  


how to find a 5th bit is set in c program

4 Answers   IBM,






What is memmove?

1 Answers   Oracle,


Develop a program that computes the new price of an item. The program should receive a character variable colour and a double precision floating-point variable price from the user. Discount rate is determined based on the colour of the discount sticker, as shown in the following table. An error message should be printed if an invalid colour has been entered

1 Answers  


Write a progarm to find the length of string using switch case?

0 Answers   TCS,


what is the output of the following program? main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); }

7 Answers  


What is the output of the program given below #include<stdio.h> main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

21 Answers   TCS, ADITI, Student,


how to use enum datatype?Please explain me?

3 Answers   Excel,


how can use subset in c program and give more example

0 Answers  






Categories