Q. What is the output of C program with structure arrays?

Code:
int main()
{
    struct pens
    {
        int color;
    }p1[2];
    struct pens p2[3];
    p1[0].color=5;
    p1[1].color=9;
    printf("%d ",p1[0].color);
    printf("%d",p1[1].color);
    return 0;
}
  • (A) 5 5
  • (B) 9 5
  • (C) 5 9
  • (D) Compiler error
πŸ’¬ Discuss
βœ… Correct Answer: (C) 5 9

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
272
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
99%
Success Rate