pointer to structure n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Pointer to Structure PowerPoint Presentation
Download Presentation
Pointer to Structure

Loading in 2 Seconds...

play fullscreen
1 / 5

Pointer to Structure - PowerPoint PPT Presentation


  • 69 Views
  • Uploaded on

Pointer to Structure. Pointer to Structure. Structure variable can be access using pointers int a=10,*p; Here p is an integer type pointer variable, p can hold the address of an integer(a) ie p=&a; in order to access the content of a  *p

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Pointer to Structure' - acton-bright


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
pointer to structure1
Pointer to Structure
  • Structure variable can be access using pointers
  • int a=10,*p;
  • Here p is an integer type pointer variable,

p can hold the address of an integer(a)

iep=&a;

in order to access the content of a  *p

ie ‘a’ can be access using the pointer variable p

  • Like that a structure variable can be access using a pointer variable
pointer to structure2
Pointer to Structure
  • let
  • struct student
  • {
  • char name[20];
  • int m1,m2,m3,total
  • };

struct student s , *p;

Now ‘s’ is the variable of type struct student

‘p’ is a pointer variable of type struct student

Since p and s are same type, p can store the address of the variable s

Iep=&s;

Now the content of p is address of s

pointer to structure3
Pointer to Structure
  • The structure variable s can be access using p
  • With the help of point to operator (->)
  • ie
  • p->name equalant to s.name
  • p->m1 equalant to s.m1
  • p->m2 equalant to s.m2
  • p->m3 equalant to s.m3
  • p->total equalant to s.total
pointer to structure4
Pointer to Structure
  • void main()
  • {
  • struct check
  • {
  • int a;
  • char c[20];
  • };
  • struct check s,*p;
  • p=&s;
  • scanf("%d%s",&p->a,p->c);
  • printf("%d %s",p->a,p->c);
  • getch();
  • }