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
Explain what is the benefit of using #define to declare a constant?
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.
Are pointers integers in c?
How are Structure passing and returning implemented by the complier?
What is a string?
What is enumerated data type in c?
What are the types of macro formats?
What is advantage of pointer in c?
What does it mean when the linker says that _end is undefined?
What is difference between arrays and pointers?
Write a program to check armstrong number in c?
What is mean by data types in c?
What is wrong in this statement?
What are multibyte characters?
What is typedef struct in c?