Question
Easy

In C program, what is the right syntax to access value of structure variable book {price, page}?

1
printf(""%d%d"", book.price, book.page);
2
printf(""%d%d"", price.book, page.book);
3
printf(""%d%d"", price::book, page ::book);
4
printf(""%d%d"", price->book, page->book);
Question Details
Time to Solve: 12
Exam: HTET
Level/Paper: Level 3
Chapter: Data Structures (Through C++)
Topic: Arrays & Structure
Correct Answer
Option A
Explanation

The correct option is (1): printf(""%d%d"", book.price, book.page); The fundamental principle for accessing members of a structure in C programming is the use of the dot operator (.). When you declare a structure variable, such as book in this scenario, the dot operator acts as the member selection operator, allowing you to directly reach the individual elements (fields) stored within that variable. The required syntax is always the **structure variable…Read More

In c program what - HTET Level 3 | Clear Cutoff