SlideShare a Scribd company logo
Prepared by
Mohammed Sikander
Technical Lead
Cranes Software International Limited
mohammed.sikander@cranessoftware.com 2
char *ptr_name = “SIKANDER”;
char str_name[ ] = “SIKANDER”;
• Can we make a pointer point to string literal?
mohammed.sikander@cranessoftware.com 3
char *ptr_name = “SIKANDER”;
char str_name[ ] = “SIKANDER”;
printf(“ %s n“ , ptr_name);
printf(“ %s n“ , str_name);
• Can we print the string through pointer.
mohammed.sikander@cranessoftware.com 4
char *ptr_name = “SIKANDER”;
char str_name[ ] = “SIKANDER”;
printf(“Length of %s = %dn“ , ptr_name , strlen(ptr_name));
printf(“Length of %s = %dn“ , str_name , strlen(str_name));
mohammed.sikander@cranessoftware.com 5
char *ptr_name = “SIKANDER”;
char str_name[ ] = “MUQADDAR”;
printf(“Size of ptr_name = %dn“ , sizeof(ptr_name));
printf(“Size of str_name = %dn“ , sizeof(str_name));
mohammed.sikander@cranessoftware.com 6
mohammed.sikander@cranessoftware.com 7
mohammed.sikander@cranessoftware.com 8
We can have arrays where each element
can be a pointer
int *
char **
int *
int *
int *
int *
int *arr_ptr[5];
int
int
int
int
int
int arr[5];
What is size of arr?
What is size of arr_ptr?
char **
Char *arr_ptr[5];
char
*
char *
char *
char *
char *
char
char
char
char
char
Char arr[5];
What is size of arr?
What is size of arr_ptr?
int x = 10;
int *ptr = &x;
int arr[5]
int *ptr = arr;
int a = 10;
int b = 23;
int arr[ ] = {12,34,54};
int *ptr[ ] = {&a , &b , arr};
char *capitalCities[] = { “Bangalore”, “Chennai”,
“Guwahati”, “Amravathi”};
Bangalore
Chennai
Guwahati
Amravathi
*
*
*
*
char *
char *
char *
char *
char *str = “VxWorks”;
mohammed.sikander@cranessoftware.com 13
 names++ tries to change the base address of array.
 We cannot change the base address of array.
 Str was a pointer, names is an array.
mohammed.sikander@cranessoftware.com 14
mohammed.sikander@cranessoftware.com 15
mohammed.sikander@cranessoftware.com 16
char **
*
Bangalore
Chennai
Guwahati
Amravathi
NULL
*
*
*
*
char *
char *
char *
char *
 Void pointers can hold the address of any
type of object.
 Dereferencing on void pointers are not
allowed.
 Incrementing void pointers are not allowed.
mohammed.sikander@cranessoftware.com 19

More Related Content

PPTX
Pointer level 2
PPTX
PDF
Implementation of c string functions
PPT
C questions
PDF
Implementing string
PPT
Cquestions
PPTX
Function basics
PDF
Stl algorithm-Basic types
Pointer level 2
Implementation of c string functions
C questions
Implementing string
Cquestions
Function basics
Stl algorithm-Basic types

What's hot (20)

PDF
C Prog. - Structures
DOCX
SaraPIC
PPTX
4. chapter iii
DOCX
Data Structures Using C Practical File
PDF
Understanding storage class using nm
PPTX
3. chapter ii
DOCX
C lab manaual
PDF
C Prog - Strings
PDF
C Prog. - Strings (Updated)
PDF
Data Structures Practical File
PDF
C Prog - Array
DOCX
Practical File of C Language
DOCX
ADA FILE
PDF
Nonlinear analysis of braced frame with hinge by hinge method in c programming
PDF
Geometric nonlinearity analysis of springs with rigid element displacement co...
DOC
Basic c programs updated on 31.8.2020
PDF
Cpd lecture im 207
PPSX
C programming array & shorting
PDF
Data structures lab manual
DOCX
DAA Lab File C Programs
C Prog. - Structures
SaraPIC
4. chapter iii
Data Structures Using C Practical File
Understanding storage class using nm
3. chapter ii
C lab manaual
C Prog - Strings
C Prog. - Strings (Updated)
Data Structures Practical File
C Prog - Array
Practical File of C Language
ADA FILE
Nonlinear analysis of braced frame with hinge by hinge method in c programming
Geometric nonlinearity analysis of springs with rigid element displacement co...
Basic c programs updated on 31.8.2020
Cpd lecture im 207
C programming array & shorting
Data structures lab manual
DAA Lab File C Programs
Ad

Viewers also liked (20)

PDF
Social Media & Social Business 시대, Agency는 무엇을 준비해야 하는가?
PDF
Cbse marking scheme 2006 2011
PDF
Programma europeo COSME
PPTX
El Hombre Como Líder 57
PPTX
Prototype and test
PPTX
for loops
PDF
Coaching Clinic Tahap ke-2 Hari ke-5
PPTX
El camino descendente.
PDF
DOC
αυτό τον μήνα
PPT
Questions typedef and macros
PPT
PDF
Arrays in C++
PPTX
How Far Will ‘IT’ Go? Could AI One Day Replace Teachers?
PPTX
MVC for Desktop Application - Part 3
DOCX
Plan diagnostica 3. grado
PPTX
C++ classes
DOCX
Asuhan kebidanan pada ibu hamil normal. PKK 1
Social Media & Social Business 시대, Agency는 무엇을 준비해야 하는가?
Cbse marking scheme 2006 2011
Programma europeo COSME
El Hombre Como Líder 57
Prototype and test
for loops
Coaching Clinic Tahap ke-2 Hari ke-5
El camino descendente.
αυτό τον μήνα
Questions typedef and macros
Arrays in C++
How Far Will ‘IT’ Go? Could AI One Day Replace Teachers?
MVC for Desktop Application - Part 3
Plan diagnostica 3. grado
C++ classes
Asuhan kebidanan pada ibu hamil normal. PKK 1
Ad

Similar to Pointer level 2 (20)

PPTX
C Programming Language Part 11
PPSX
Concepts of C [Module 2]
DOCX
string , pointer
PPTX
Building your apps for cross platform compatability
PPTX
programming for problem solving using C-STRINGSc
PPT
When best to use the %let statement, the symput routine, or the into clause t...
PPTX
Pointer basics
PPT
input
DOCX
Computer Networks Lab File
PPTX
FPS PPT.pptx from Lekha madam encrypted file
PPTX
from Lekha Mam Encrypted Document', need decryption
PDF
DOCX
C programs
PDF
C programming day#3.
PDF
C programs Set 3
PDF
Principals of Programming in CModule -5.pdfModule-4.pdf
PPTX
Lecture_on_string_manipulation_functions.pptx
DOCX
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docx
PPTX
c programs.pptx
PPTX
comp2
C Programming Language Part 11
Concepts of C [Module 2]
string , pointer
Building your apps for cross platform compatability
programming for problem solving using C-STRINGSc
When best to use the %let statement, the symput routine, or the into clause t...
Pointer basics
input
Computer Networks Lab File
FPS PPT.pptx from Lekha madam encrypted file
from Lekha Mam Encrypted Document', need decryption
C programs
C programming day#3.
C programs Set 3
Principals of Programming in CModule -5.pdfModule-4.pdf
Lecture_on_string_manipulation_functions.pptx
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docx
c programs.pptx
comp2

More from Mohammed Sikander (20)

PDF
STL Containers in C++ : Sequence Container : Vector
PPTX
Strings in C - covers string functions
PDF
Smart Pointers, Modern Memory Management Techniques
PDF
Multithreading_in_C++ - std::thread, race condition
PDF
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
PDF
Operator Overloading in C++
PDF
Python_Regular Expression
PPTX
Modern_CPP-Range-Based For Loop.pptx
PDF
Modern_cpp_auto.pdf
PPTX
Python Functions
PPTX
Python dictionary
PDF
Python exception handling
PDF
Python tuple
PDF
Python strings
PDF
Python set
PDF
Python list
PDF
Python Flow Control
PDF
Introduction to Python
PPTX
STL Containers in C++ : Sequence Container : Vector
Strings in C - covers string functions
Smart Pointers, Modern Memory Management Techniques
Multithreading_in_C++ - std::thread, race condition
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Operator Overloading in C++
Python_Regular Expression
Modern_CPP-Range-Based For Loop.pptx
Modern_cpp_auto.pdf
Python Functions
Python dictionary
Python exception handling
Python tuple
Python strings
Python set
Python list
Python Flow Control
Introduction to Python

Recently uploaded (20)

PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
System and Network Administraation Chapter 3
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Introduction to Artificial Intelligence
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Digital Strategies for Manufacturing Companies
PDF
Nekopoi APK 2025 free lastest update
PDF
Design an Analysis of Algorithms I-SECS-1021-03
How Creative Agencies Leverage Project Management Software.pdf
Softaken Excel to vCard Converter Software.pdf
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Internet Downloader Manager (IDM) Crack 6.42 Build 41
System and Network Administraation Chapter 3
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
CHAPTER 2 - PM Management and IT Context
Wondershare Filmora 15 Crack With Activation Key [2025
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Introduction to Artificial Intelligence
Operating system designcfffgfgggggggvggggggggg
How to Migrate SBCGlobal Email to Yahoo Easily
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
Reimagine Home Health with the Power of Agentic AI​
Digital Strategies for Manufacturing Companies
Nekopoi APK 2025 free lastest update
Design an Analysis of Algorithms I-SECS-1021-03

Pointer level 2