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;
}
Discussion:
14 comments Page 2 of 2.
Babita said:
1 decade ago
-> is used to access pointer.
LuisSpain said:
1 decade ago
I can't still get the 45 value.
Tanya said:
1 decade ago
Hi Appu,
Here we are passing the address of d to pdt , and d is nothing but the object of the structure .pdt is pointer type so only -> opertaor is used to reference the member of the structure.
Here we are passing the address of d to pdt , and d is nothing but the object of the structure .pdt is pointer type so only -> opertaor is used to reference the member of the structure.
Appu said:
1 decade ago
If any one have any idea regarding this output of the program kindly give a comment.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers