SlideShare a Scribd company logo
Pointers
Unit IV
Address Operator
pointers.pptx
Pointers Variables
Declaration Of Pointer Variables
Assigning Address To Pointer Variables
Dereferencing Pointer Variables
pointers.pptx
Pointer Arithmetic
Pointers variables are also known as address data
types because they are used to store the address
of another variable. The address is the memory
location that is assigned to the variable. It doesn’t
store any value. The operations are:
• Increment/Decrement of a Pointer
• Addition of integer to a pointer
• Subtraction of integer to a pointer
• Subtracting two pointers of the same type
• Comparison of pointers of the same type.
pointers.pptx
pointers.pptx
Addition
// C program to illustrate pointer Addition
#include <stdio.h>
// Driver Code
int main()
{
// Integer variable
int N = 4;
// Pointer to an integer
int *ptr1, *ptr2;
// Pointer stores the address of N
ptr1 = &N;
ptr2 = &N;
printf("Pointer ptr2 before Addition: ");
printf("%p n", ptr2);
// Addition of 3 to ptr2
ptr2 = ptr2 + 3;
printf("Pointer ptr2 after Addition: ");
printf("%p n", ptr2);
return 0;
}
Subtraction
// C program to illustrate pointer Subtraction
#include <stdio.h>
// Driver Code
int main()
{
// Integer variable
int N = 4;
// Pointer to an integer
int *ptr1, *ptr2;
// Pointer stores the address of N
ptr1 = &N;
ptr2 = &N;
printf("Pointer ptr2 before Subtraction: ");
printf("%p n", ptr2);
// Subtraction of 3 to ptr2
ptr2 = ptr2 - 3;
printf("Pointer ptr2 after Subtraction: ");
printf("%p n", ptr2);
return 0;
}
Pointer To Pointer
pointers.pptx
pointers.pptx
Passing Pointer to a Function
When we pass a pointer as an argument instead of
a variable then the address of the variable is
passed instead of the value. So any change
made by the function using the pointer is
permanently made at the address of passed
variable. This technique is known as call by
reference in C.
pointers.pptx
Swapping two numbers using Pointers
Pointers and Arrays
Array Of Pointers
pointers.pptx
Pass Arrays to Functions
pointers.pptx
Pointers To Functions
or
Function Pointers
Declaring A Pointer To A Function
11.600000
pointers.pptx
pointers.pptx
pointers.pptx
pointers.pptx
pointers.pptx
pointers.pptx
pointers.pptx
pointers.pptx
pointers.pptx

More Related Content

PDF
VIT351 Software Development VI Unit3
PDF
Pointers in C
PPTX
4 Pointers.pptx
PPT
pointers (1).ppt
PDF
Pointers in C language
PPTX
Pointer.pptx
PDF
PSPC--UNIT-5.pdf
PPT
Basics of pointer, pointer expressions, pointer to pointer and pointer in fun...
VIT351 Software Development VI Unit3
Pointers in C
4 Pointers.pptx
pointers (1).ppt
Pointers in C language
Pointer.pptx
PSPC--UNIT-5.pdf
Basics of pointer, pointer expressions, pointer to pointer and pointer in fun...

Similar to pointers.pptx (20)

PDF
Pointers
PPTX
PPS-POINTERS.pptx
PDF
EASY UNDERSTANDING OF POINTERS IN C LANGUAGE.pdf
PPTX
Pointers in C Programming
PPTX
Chp3(pointers ref)
PPTX
Pointer in C
PPTX
2-Concept of Pointers in c programming.pptx
PPTX
Unit-I Pointer Data structure.pptx
PPT
Pointer introduction day1
PDF
Pointers-Computer programming
PPTX
Pointers and single &multi dimentionalarrays.pptx
PPTX
FYBSC(CS)_UNIT-1_Pointers in C.pptx
PPTX
UNIT 4 POINTERS.pptx pointers pptx for basic c language
PPTX
pointers.pptx
PPTX
Unit-4-1.pptxjtjrjfjfjfjfjfjfjfjrjrjrjrjejejeje
PPTX
COM1407: Working with Pointers
PPTX
Array in C newrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
PPTX
INTERMEDIATE PROGRAMMING POINTERS IN C.pptx
PPT
SPC Unit 3
Pointers
PPS-POINTERS.pptx
EASY UNDERSTANDING OF POINTERS IN C LANGUAGE.pdf
Pointers in C Programming
Chp3(pointers ref)
Pointer in C
2-Concept of Pointers in c programming.pptx
Unit-I Pointer Data structure.pptx
Pointer introduction day1
Pointers-Computer programming
Pointers and single &multi dimentionalarrays.pptx
FYBSC(CS)_UNIT-1_Pointers in C.pptx
UNIT 4 POINTERS.pptx pointers pptx for basic c language
pointers.pptx
Unit-4-1.pptxjtjrjfjfjfjfjfjfjfjrjrjrjrjejejeje
COM1407: Working with Pointers
Array in C newrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
INTERMEDIATE PROGRAMMING POINTERS IN C.pptx
SPC Unit 3

More from zeenatparveen24 (10)

PPT
object orineted programming looping .ppt
PPT
object oriented programming concept .ppt
PPT
c++ control structure statements .ppt
PPTX
introduction to c++concept presentation.pptx
PPT
8 Normalization (1).ppt
PDF
Cunit3.pdf
PPTX
COCOMO.pptx
PPTX
4 B-Coupling and Cohesion-1.pptx
PPTX
Unit II.pptx
PPTX
cunit1.pptx
object orineted programming looping .ppt
object oriented programming concept .ppt
c++ control structure statements .ppt
introduction to c++concept presentation.pptx
8 Normalization (1).ppt
Cunit3.pdf
COCOMO.pptx
4 B-Coupling and Cohesion-1.pptx
Unit II.pptx
cunit1.pptx

Recently uploaded (20)

PPTX
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPT
Occupational Health and Safety Management System
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PPTX
Fundamentals of Mechanical Engineering.pptx
PDF
Abrasive, erosive and cavitation wear.pdf
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PDF
Integrating Fractal Dimension and Time Series Analysis for Optimized Hyperspe...
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Soil Improvement Techniques Note - Rabbi
PPT
A5_DistSysCh1.ppt_INTRODUCTION TO DISTRIBUTED SYSTEMS
PPTX
UNIT 4 Total Quality Management .pptx
PPT
introduction to datamining and warehousing
PPT
Total quality management ppt for engineering students
PDF
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Occupational Health and Safety Management System
R24 SURVEYING LAB MANUAL for civil enggi
Automation-in-Manufacturing-Chapter-Introduction.pdf
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
Fundamentals of Mechanical Engineering.pptx
Abrasive, erosive and cavitation wear.pdf
Categorization of Factors Affecting Classification Algorithms Selection
Integrating Fractal Dimension and Time Series Analysis for Optimized Hyperspe...
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Soil Improvement Techniques Note - Rabbi
A5_DistSysCh1.ppt_INTRODUCTION TO DISTRIBUTED SYSTEMS
UNIT 4 Total Quality Management .pptx
introduction to datamining and warehousing
Total quality management ppt for engineering students
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...

pointers.pptx

  • 6. Assigning Address To Pointer Variables
  • 9. Pointer Arithmetic Pointers variables are also known as address data types because they are used to store the address of another variable. The address is the memory location that is assigned to the variable. It doesn’t store any value. The operations are: • Increment/Decrement of a Pointer • Addition of integer to a pointer • Subtraction of integer to a pointer • Subtracting two pointers of the same type • Comparison of pointers of the same type.
  • 12. Addition // C program to illustrate pointer Addition #include <stdio.h> // Driver Code int main() { // Integer variable int N = 4; // Pointer to an integer int *ptr1, *ptr2; // Pointer stores the address of N ptr1 = &N; ptr2 = &N; printf("Pointer ptr2 before Addition: "); printf("%p n", ptr2); // Addition of 3 to ptr2 ptr2 = ptr2 + 3; printf("Pointer ptr2 after Addition: "); printf("%p n", ptr2); return 0; }
  • 13. Subtraction // C program to illustrate pointer Subtraction #include <stdio.h> // Driver Code int main() { // Integer variable int N = 4; // Pointer to an integer int *ptr1, *ptr2; // Pointer stores the address of N ptr1 = &N; ptr2 = &N; printf("Pointer ptr2 before Subtraction: "); printf("%p n", ptr2); // Subtraction of 3 to ptr2 ptr2 = ptr2 - 3; printf("Pointer ptr2 after Subtraction: "); printf("%p n", ptr2); return 0; }
  • 17. Passing Pointer to a Function When we pass a pointer as an argument instead of a variable then the address of the variable is passed instead of the value. So any change made by the function using the pointer is permanently made at the address of passed variable. This technique is known as call by reference in C.
  • 19. Swapping two numbers using Pointers
  • 23. Pass Arrays to Functions
  • 26. Declaring A Pointer To A Function