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 are 16- and 32-bit numbers stored?
the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b
Explain about the constants which help in debugging?
explain what are pointers?
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
Write a program to check prime number in c programming?
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
How do you declare a variable that will hold string values?
How to draw the flowchart for structure programs?
What is the difference between the local variable and global variable in c?
In which layer of the network datastructure format change is done
why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above
What does %p mean c?
Explain how to reverse singly link list.
What are valid signatures for the Main function?