12.12 Write a program to display the contents of the structure using ordinary pointer.
#include <stdio.h>
# include <conio.h>
void main()
{
int *p;
struct num
{
int a;
int b;
int c;
}'•
struct num d;
d.a«2;
d.b=3;
d.c*4;
pa&d.a;
clrscr();
printf ("\n a=%d”,*p);
printf ("\nb=%d",*(++p));
printf ("\n c=%d",*(++p));
I
OUTPUT;
b«3
ExplanationIn the above program *p and structure num are declared. The structure num has
three members a, b & c of integer data type and initialized with the values 2, 3 and 4 respectively.
We know that structure variables are stored in succe ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.