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
Is there any data type in c with variable size?
How to establish connection with oracle database software from c language?
Write a c program to demonstrate character and string constants?
What is the use of define in c?
#include
Explain is it better to bitshift a value than to multiply by 2?
Find duplicates in a file containing 6 digit number (like uid) in O (n) time.
How was c created?
Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)
Write a c program to build a heap method using Pointer to function and pointer to structure ?
Where we use clrscr in c?
Is it possible to execute code even after the program exits the main() function?
How can you call a function, given its name as a string?
Explain the advantages of using macro in c language?
Explain the priority queues?