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

MCQs

,

study material

,

Extra Questions

,

video lectures

,

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

,

ppt

,

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

,

Sample Paper

,

Free

,

Viva Questions

,

Previous Year Questions with Solutions

,

Exam

,

shortcuts and tricks

,

Summary

,

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

,

Semester Notes

,

practice quizzes

,

mock tests for examination

,

pdf

,

Objective type Questions

,

past year papers

,

Important questions

;