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
How to explain the final year project as a fresher please answer with sample project
Why are algorithms important in c program?
What does it mean when the linker says that _end is undefined?
How can I find out how much free space is available on disk?
What is unary operator?
Why do we use stdio h and conio h?
How do you define a string?
What is file in c language?
Is anything faster than c?
Is it possible to pass an entire structure to functions?
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
What is the use of parallelize in spark?
Which is the memory area not included in C program? give the reason
Can include files be nested? How many levels deep can include files be nested?
Write a program to implement queue.