C Programming - Structures, Unions, Enums - Discussion

Discussion Forum : Structures, Unions, Enums - Point Out Correct Statements (Q.No. 3)
3.
Which of the following statements correctly assigns 12 to month using pointer variable pdt?
#include<stdio.h>

    struct date
    {
        int day;
        int month;
        int year;
    };
int main()
{
    struct date d;
    struct date *pdt;
    pdt = &d;
    return 0;
}
pdt.month = 12
&pdt.month = 12
d.month = 12
pdt->month = 12
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
14 comments Page 2 of 2.

Pravin pandhare said:   9 years ago
d.month=10;
printf("%d",d.month);

Output: 10.

Babita said:   1 decade ago
-> is used to access pointer.

LuisSpain said:   1 decade ago
I can't still get the 45 value.

Taran rishit said:   7 years ago
(*d).month is valid I think.


Post your comments here:

Your comments will be displayed after verification.