Short Notes: Pointer to Structure | Short Notes for Computer Science Engineering - Computer Science Engineering (CSE) PDF Download

Download, print and study this document offline
Please wait while the PDF view is loading
 Page 1


POINTER TO STRUCTURES
You may recall that the name of an array stands for the address of its zero-th element. Also true 
for the names of arrays of structure variables.
Consider the declaration:
struct stud { 
int roll;
char dept_code[25]; 
float cgpa;
} class[100], *ptr ;
The name class represents the address of the zero-th element of the structure array. ptr is a 
pointer to data objects of the type struct stud. The assignment ptr = class; will assign the 
address of class[0] to ptr.
When the pointer ptr is incremented by one (ptr++) :
The value of ptr is actually increased by sizeof(stud).
It is made to point to the next record.
Once ptr points to a structure variable, the members can be accessed as:
ptr -> roll;
ptr -> dept_code;
ptr -> cgpa;
The symbol “->” is called the arrow operator.
Read More
90 docs

Top Courses for Computer Science Engineering (CSE)

Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Short Notes: Pointer to Structure | Short Notes for Computer Science Engineering - Computer Science Engineering (CSE)

,

Previous Year Questions with Solutions

,

Objective type Questions

,

Summary

,

past year papers

,

pdf

,

Important questions

,

mock tests for examination

,

Extra Questions

,

practice quizzes

,

ppt

,

Short Notes: Pointer to Structure | Short Notes for Computer Science Engineering - Computer Science Engineering (CSE)

,

Semester Notes

,

study material

,

Short Notes: Pointer to Structure | Short Notes for Computer Science Engineering - Computer Science Engineering (CSE)

,

Free

,

Viva Questions

,

MCQs

,

Exam

,

video lectures

,

Sample Paper

,

shortcuts and tricks

;