C Programming - Declarations and Initializations - Discussion
Discussion Forum : Declarations and Initializations - Point Out Correct Statements (Q.No. 4)
4.
Which of the structure is incorrcet?
1 : |
|
2 : |
|
3 : |
|
Answer: Option
Explanation:
Option B gives "Undefined structure in 'aa'" error.
Discussion:
29 comments Page 1 of 3.
Harsha said:
1 decade ago
Why it gives such error? Give clear explanation.
Arulrexin said:
1 decade ago
If we can see that program is that second time used stuct variable with using pointer.
Rashmi said:
1 decade ago
Why B is wrong and C is correct? Please explain.
Kirti said:
1 decade ago
Why B is wrong and C is correct? Please explain.
Mani said:
1 decade ago
Why it is incorrect please incorrect?
Sandeep said:
1 decade ago
Option B is declaring a structure variable of the same type in the same structure where as option C is declaring a pointer to the structure variable of the same type. (used in linked lists. ).
B is not allowed as the structure variable declaration can't be done until the structure is declared.
B is not allowed as the structure variable declaration can't be done until the structure is declared.
Sampavi said:
1 decade ago
I can't understand. Give briefy explaination.
Sundar said:
1 decade ago
Option 2, it can be used for creating linked list. A node should have have a link to next node of same type. For this purpose pointer to the same struct (type) is required.
Hariom said:
1 decade ago
Can you please explain more in this question?
Vinod kumar said:
1 decade ago
In this prob. We couldn't create a same structure type within that structure. It will make linking error.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers