Skip to Main Content
Programming and Data Structures
book

Programming and Data Structures

by Ashok Kamthane
August 2009
Intermediate to advanced content levelIntermediate to advanced
604 pages
21h 39m
English
Pearson India
Content preview from Programming and Data Structures
Structure and Union 389
12.12 Write a program to display the contents of the structure using ordinary pointer.
# include < s tdio .h >
# includ e <conio.h>
vo id m ain()
{
in t *p;
s tru c t num
{
in t a;
in t b;
in t c;
}'•
s tru c t num d;
d .a «2 ;
d.b =3;
d .c *4 ;
pa&d.a;
c l r s c r ( ) ;
printf ("\ n a=% d”,*p);
printf ("\ n b= % d ",*(+ + p ));
printf ("\n c=% d ",*(+ + p ));
I
OUTPUT;
b«3
Explanation In the above program *p and s tru c tu re 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.
Start your free trial

You might also like

Learning Data Structures and Algorithms

Learning Data Structures and Algorithms

Rod Stephens
Data Structures and Algorithms in C++, Second Edition

Data Structures and Algorithms in C++, Second Edition

Michael T. Goodrich, Roberto Tamassia, David M. Mount

Publisher Resources

ISBN: 9789332506343