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 are the different file extensions involved when programming in C?
How to print "Hi World" without using semi colon?
What tq means in chat?
What are c identifiers?
Are local variables initialized to zero by default in c?
What are dynamically linked and statically linked libraries?
what is the function of .h in #include<stdio.h> in c ?
23 Answers HCL, IBM, Wipro,
Explain what is the benefit of using const for declaring constants?
simple program for virtual function?
Can we use any name in place of argv and argc as command line arguments?
a value that does not change during program execution a) variabe b) argument c) parameter d) none
If the size of int data type is two bytes, what is the range of signed int data type?