Find Error if any in below code, Justify ur answer:
struct xx
{
int a;
struct yy
{
char c;
struct xx* p;
}
struct yy* q;
}
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / raj
struct xx
{
int a;
struct yy
{
char c;
struct xx* p;
};//Semicolon is missing
struct yy* q;
}
Is This Answer Correct ? | 0 Yes | 4 No |
what is the output of following question? void main() { int i=0,a[3]; a[i]=i++; printf("%d",a[i] }
Three major criteria of scheduling.
how can I convert a string to a number?
What are the three constants used in c?
Which of the Following will define a type NODE that is a node in a Linked list? A)struct node {NODE*next;int x;};type def struct node NODE; B)typedef struct NODE {struct NODE *next;int x;}; C)typedef struct NODE {NODE *next;int x;}; D)typedef struct {NODE *next;int x;}NODE;
What is a stream?
What is memcpy() function?
write a program that print itself even if the source file is deleted?
what will be the output for the following main() { printf("hi" "hello"); }
What do you mean by a sequential access file?
Why does not c have an exponentiation operator?
the question is that what you have been doing all these periods (one year gap)