Download presentation
Presentation is loading. Please wait.
Published byBrice Walters Modified over 8 years ago
1
POINTERS IN C
2
Introduction A pointer is a variable that holds a memory address This address is the location of another object (typically another variable) in memory Use of pointers is crucial to successful C programming Pointers support dynamic allocation Pointer containing an invalid value can cause your program to crash
3
Declaring pointer variables A pointer declaration consists of a base data type, an *, and the variable name. Data type *name; Ex. : int *var1; int * - Any address that it holds points to an integer Pointer Operators * and &. & is a unary operator that returns the memory address of its operand
4
Accessing address using Pointer Example int *m, count=10,q; m = &count; //stores memory address of count into m q = *m; // stores values located at the address 10
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.