Presentation is loading. Please wait.

Presentation is loading. Please wait.

POINTERS IN C. Introduction  A pointer is a variable that holds a memory address  This address is the location of another object (typically another.

Similar presentations


Presentation on theme: "POINTERS IN C. Introduction  A pointer is a variable that holds a memory address  This address is the location of another object (typically another."— Presentation transcript:

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

5

6

7

8

9

10

11

12

13

14

15


Download ppt "POINTERS IN C. Introduction  A pointer is a variable that holds a memory address  This address is the location of another object (typically another."

Similar presentations


Ads by Google