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
What is a char in c?
What is a void * in c?
What is data structure in c and its types?
What are the restrictions of a modulus operator?
can anyone suggest some site name..where i can get some good data structure puzzles???
What will be the outcome of the following conditional statement if the value of variable s is 10?
What is main return c?
What is stack in c?
what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?
i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical
What would be an example of a structure analogous to structure c?
What is 'bus error'?
int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer
What are the two forms of #include directive?
Explain what does a function declared as pascal do differently?