C Programming - Declarations and Initializations - Discussion

Discussion Forum : Declarations and Initializations - Point Out Correct Statements (Q.No. 5)
5.
Which of the structure is correct?
1 :
struct book
{
    char name[10];
    float price;
    int pages;
};
2 :
struct aa
{
    char name[10];
    float price;
    int pages;
}
3 :
struct aa
{
    char name[10];
    float price;
    int pages;
}
1
2
3
All of above
Answer: Option
Explanation:
In 2 and 3 semicolon are missing in structure element.
Discussion:
8 comments Page 1 of 1.

Subhash.p said:   3 years ago
I think both 2&3 are wrong because it don't have semi column.

Nirmalajyothi said:   4 years ago
I think the three statements have the semicolon. But in the explanation you said that semicolons is missing in 2&3 statements.

Anu said:   5 years ago
All three statements are correct.

Vijay said:   5 years ago
According to me, all three statements ate correct.

Priya said:   6 years ago
I thought all the 3 would be correct.

Kavya said:   7 years ago
Does the structure end with a semicolon (;)?

Ashitosh m n said:   7 years ago
Structure also ends with semicolon as per syntax of structure!

Jagajjeevan said:   1 decade ago
Why do you take Semicolon(;)?

Post your comments here:

Your comments will be displayed after verification.