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

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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to explain the final year project as a fresher please answer with sample project

459


Why are algorithms important in c program?

610


What does it mean when the linker says that _end is undefined?

621


How can I find out how much free space is available on disk?

620


What is unary operator?

650






Why do we use stdio h and conio h?

625


How do you define a string?

647


What is file in c language?

568


Is anything faster than c?

575


Is it possible to pass an entire structure to functions?

548


c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above

604


What is the use of parallelize in spark?

566


Which is the memory area not included in C program? give the reason

1493


Can include files be nested? How many levels deep can include files be nested?

649


Write a program to implement queue.

653