0% found this document useful (0 votes)
4 views18 pages

C Programming Unit-5 Pointers

Pointers are a derived data type in C that store memory addresses, allowing efficient access and manipulation of data in memory. They provide benefits such as handling arrays, returning multiple values from functions, and supporting dynamic memory management, which enhances program efficiency and execution speed. Pointer variables hold memory addresses and can be accessed using the '&' operator to determine the location of other variables in memory.

Uploaded by

Mohammed Sadiq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views18 pages

C Programming Unit-5 Pointers

Pointers are a derived data type in C that store memory addresses, allowing efficient access and manipulation of data in memory. They provide benefits such as handling arrays, returning multiple values from functions, and supporting dynamic memory management, which enhances program efficiency and execution speed. Pointer variables hold memory addresses and can be accessed using the '&' operator to determine the location of other variables in memory.

Uploaded by

Mohammed Sadiq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

POINTERS

INTRODUCTION
• A pointer is a derived data type in C.
• Pointers contain memory addresses as their values.
• Since these memory addresses are the locations in
the computer memory where program instructions
and data are stored, pointers can be used to access
and manipulate data stored in the memory.
POINTERS BENEFITS TO THE
PROGRAMMER
• Pointers are more efficient in handling arrays and data tables.
• Pointers can be used to return multiple values from a function via
function arguments.
• Pointers permit references to functions and thereby facilitating passing of
function as arguments to other functions.
• The use of pointers arrays to character stings results in saving of data
storage space in memory.
• Pointers allow C to support dynamic memory management.
• Pointers provide an efficient tool for manipulating dynamic data
structures such as structures, linked lists, queues, stacks and trees.
• Pointers reduce length and complexity of programs.
• They increase the execution speed and thus reduce the program
execution time.
UNDERSTANDING POINTER
• The computer’s memory is a
sequential collection of storage cells
• Each cell. Commonly known as a byte,
has a number called address
associated with it
• The address are numbers
consecutively, starting from zero
• The last address depends on the
memory size
• A computer system having 64K
memory will have its last address as
65,535
POINTER VARIABLE
• We may access the value 547 by using either the
name X or the address 4000.
• Since memory addresses are simply numbers, they
can be assigned to some variables, that can be
stored in memory, like any other variable.
• Such variables that hold memory addresses are
called pointer variables.
• A pointer variable is, nothing but a variable that
contains an address, which is a location of another
variable in memory.
ACCESSING THE ADDRESS OF A
VARIABLE
• The actual location of a variable in the memory is
system dependent.
• We can determine the address of a variable with the
help of the operator & available in C.
• The operator & immediately preceding a variable
returns the address of the variable associated with it.
p = &quantity
• Would assign the address 5000 to the variable p

You might also like