SlideShare una empresa de Scribd logo
1 de 11
Descargar para leer sin conexión
Author – Subhasis Nayak
 A pointer is a variable that holds a
  memory address. That’s it.
 This is what the difference in between
  variable and pointer.
    ◦ Pointer holds the address
    ◦ Variable holds the value.
   Computer     memory        is    divided   into
    sequentially numbered       memory locations.
    Each variable is located   at a unique location
    in memory, known as its    address.




              Memory representation
 Thecapability to use pointers and
 manipulate memory at a low level
 is one of the factors that makes
 C++ the language of choice for
 embedded        and      real-time
 applications.
   Different computers number this memory
    using different complex schemes.
   We must happy, as a programmer, We don’t
    need to know the particular address of any
    given variable because the compiler handles
    the details.
   If we want this information, though, you can
    use the address-of operator (&), which
    returns the address of an object in memory.
   It is so simple to declare a pointer. We need
    the type of the pointer
   Next the name of the pointer.
   When we declare a pointer variable such as
    pointer, the compiler sets aside enough
    memory to hold an address


           int *pointer;
   A pointer that is not initialized is called a wild
    pointer because you have no idea what it is
    pointing to.
   If you want to initialize you can as like we do
    for variable. int *intPointer = 0;
   A pointer whose value is zero is called a null
    pointer.
   All pointers, when they are created, should be
    initialized to something.
   Every variable has an address. Even without
    knowing the specific address, you can store a
    variable’s address in a pointer.




             Declaring pointer   Passing address
Holds the value




Holds the address
   Type must be same to the variable whose
    address is going to pass to the pointer.
   When you want to pass the address of the
    variable use (&) before the variable name.
   When you want to pass the value use (*)
    before the pointer.

Más contenido relacionado

La actualidad más candente

Constructor and Destructor
Constructor and DestructorConstructor and Destructor
Constructor and Destructor
Kamal Acharya
 

La actualidad más candente (20)

C programming - Pointers
C programming - PointersC programming - Pointers
C programming - Pointers
 
Pointer in C++
Pointer in C++Pointer in C++
Pointer in C++
 
Pointer in C
Pointer in CPointer in C
Pointer in C
 
Constructor and destructor
Constructor  and  destructor Constructor  and  destructor
Constructor and destructor
 
This pointer
This pointerThis pointer
This pointer
 
C pointer
C pointerC pointer
C pointer
 
Pointers,virtual functions and polymorphism cpp
Pointers,virtual functions and polymorphism cppPointers,virtual functions and polymorphism cpp
Pointers,virtual functions and polymorphism cpp
 
Pointer in c
Pointer in cPointer in c
Pointer in c
 
Constructors and Destructor in C++
Constructors and Destructor in C++Constructors and Destructor in C++
Constructors and Destructor in C++
 
Basics of pointer, pointer expressions, pointer to pointer and pointer in fun...
Basics of pointer, pointer expressions, pointer to pointer and pointer in fun...Basics of pointer, pointer expressions, pointer to pointer and pointer in fun...
Basics of pointer, pointer expressions, pointer to pointer and pointer in fun...
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
 
Unit 8. Pointers
Unit 8. PointersUnit 8. Pointers
Unit 8. Pointers
 
C Programming : Pointers and Strings
C Programming : Pointers and StringsC Programming : Pointers and Strings
C Programming : Pointers and Strings
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
 
POINTERS IN C
POINTERS IN CPOINTERS IN C
POINTERS IN C
 
Constructor and Destructor
Constructor and DestructorConstructor and Destructor
Constructor and Destructor
 
pointers
pointerspointers
pointers
 
Pointers C programming
Pointers  C programmingPointers  C programming
Pointers C programming
 
Array Of Pointers
Array Of PointersArray Of Pointers
Array Of Pointers
 
Structures in c++
Structures in c++Structures in c++
Structures in c++
 

Destacado

Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).ppt
Alok Kumar
 
02 c++ Array Pointer
02 c++ Array Pointer02 c++ Array Pointer
02 c++ Array Pointer
Tareq Hasan
 
Chp3(pointers ref)
Chp3(pointers ref)Chp3(pointers ref)
Chp3(pointers ref)
Mohd Effandi
 

Destacado (20)

C++ Pointers
C++ PointersC++ Pointers
C++ Pointers
 
Unit 6 pointers
Unit 6   pointersUnit 6   pointers
Unit 6 pointers
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
 
Pointers
PointersPointers
Pointers
 
Pointers in C
Pointers in CPointers in C
Pointers in C
 
intro to pointer C++
intro to  pointer C++intro to  pointer C++
intro to pointer C++
 
Learning C++ - Pointers in c++ 2
Learning C++ - Pointers in c++ 2Learning C++ - Pointers in c++ 2
Learning C++ - Pointers in c++ 2
 
c++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ programc++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ program
 
C Pointers
C PointersC Pointers
C Pointers
 
Pointer in c++ part2
Pointer in c++ part2Pointer in c++ part2
Pointer in c++ part2
 
Structure of C++ - R.D.Sivakumar
Structure of C++ - R.D.SivakumarStructure of C++ - R.D.Sivakumar
Structure of C++ - R.D.Sivakumar
 
Array in c++
Array in c++Array in c++
Array in c++
 
Pointers in C Programming
Pointers in C ProgrammingPointers in C Programming
Pointers in C Programming
 
Pointers & References in C++
Pointers & References in C++Pointers & References in C++
Pointers & References in C++
 
C++ classes
C++ classesC++ classes
C++ classes
 
Ponters
PontersPonters
Ponters
 
Pointers+(2)
Pointers+(2)Pointers+(2)
Pointers+(2)
 
Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).ppt
 
02 c++ Array Pointer
02 c++ Array Pointer02 c++ Array Pointer
02 c++ Array Pointer
 
Chp3(pointers ref)
Chp3(pointers ref)Chp3(pointers ref)
Chp3(pointers ref)
 

Similar a Pointer in c++ part1

Pointers in c
Pointers in cPointers in c
Pointers in c
Mohd Arif
 

Similar a Pointer in c++ part1 (20)

POINTERS IN C MRS.SOWMYA JYOTHI.pdf
POINTERS IN C MRS.SOWMYA JYOTHI.pdfPOINTERS IN C MRS.SOWMYA JYOTHI.pdf
POINTERS IN C MRS.SOWMYA JYOTHI.pdf
 
Pointers in c language
Pointers in c languagePointers in c language
Pointers in c language
 
Pointers in c v5 12102017 1
Pointers in c v5 12102017 1Pointers in c v5 12102017 1
Pointers in c v5 12102017 1
 
Lab 3.pptx
Lab 3.pptxLab 3.pptx
Lab 3.pptx
 
Lab 3.pptx
Lab 3.pptxLab 3.pptx
Lab 3.pptx
 
Pointers
PointersPointers
Pointers
 
VIT351 Software Development VI Unit3
VIT351 Software Development VI Unit3VIT351 Software Development VI Unit3
VIT351 Software Development VI Unit3
 
INTERMEDIATE PROGRAMMING POINTERS IN C.pptx
INTERMEDIATE PROGRAMMING POINTERS IN C.pptxINTERMEDIATE PROGRAMMING POINTERS IN C.pptx
INTERMEDIATE PROGRAMMING POINTERS IN C.pptx
 
Pointers_in_c_2024.01.10_embedded _c.pptx
Pointers_in_c_2024.01.10_embedded _c.pptxPointers_in_c_2024.01.10_embedded _c.pptx
Pointers_in_c_2024.01.10_embedded _c.pptx
 
Pointers in C
Pointers in CPointers in C
Pointers in C
 
PSPC--UNIT-5.pdf
PSPC--UNIT-5.pdfPSPC--UNIT-5.pdf
PSPC--UNIT-5.pdf
 
Pointer in c
Pointer in cPointer in c
Pointer in c
 
Pointer in c
Pointer in c Pointer in c
Pointer in c
 
Pointers in c
Pointers in cPointers in c
Pointers in c
 
Pointers in c
Pointers in cPointers in c
Pointers in c
 
Pointers in c
Pointers in cPointers in c
Pointers in c
 
cprogrammingpointerstype.ppt
cprogrammingpointerstype.pptcprogrammingpointerstype.ppt
cprogrammingpointerstype.ppt
 
Pointers Refrences & dynamic memory allocation in C++
Pointers Refrences & dynamic memory allocation in C++Pointers Refrences & dynamic memory allocation in C++
Pointers Refrences & dynamic memory allocation in C++
 
Pointers in C language
Pointers  in  C languagePointers  in  C language
Pointers in C language
 
Pointers
PointersPointers
Pointers
 

Más de Subhasis Nayak

Más de Subhasis Nayak (19)

Php, mysq lpart5(mysql)
Php, mysq lpart5(mysql)Php, mysq lpart5(mysql)
Php, mysq lpart5(mysql)
 
working with database using mysql
working with database using mysql working with database using mysql
working with database using mysql
 
Php, mysq lpart3
Php, mysq lpart3Php, mysq lpart3
Php, mysq lpart3
 
Php, mysq lpart4(processing html form)
Php, mysq lpart4(processing html form)Php, mysq lpart4(processing html form)
Php, mysq lpart4(processing html form)
 
Jsp 01
Jsp 01Jsp 01
Jsp 01
 
Jsp 02(jsp directives)2003
Jsp 02(jsp directives)2003Jsp 02(jsp directives)2003
Jsp 02(jsp directives)2003
 
Php, mysq lpart1
Php, mysq lpart1Php, mysq lpart1
Php, mysq lpart1
 
Php, mysqlpart2
Php, mysqlpart2Php, mysqlpart2
Php, mysqlpart2
 
C:\fakepath\jsp01
C:\fakepath\jsp01C:\fakepath\jsp01
C:\fakepath\jsp01
 
Servlet & jsp
Servlet  &  jspServlet  &  jsp
Servlet & jsp
 
J2ee connector architecture
J2ee connector architectureJ2ee connector architecture
J2ee connector architecture
 
how to create object
how to create objecthow to create object
how to create object
 
Pointer in c++ part3
Pointer in c++ part3Pointer in c++ part3
Pointer in c++ part3
 
C++ arrays part2
C++ arrays part2C++ arrays part2
C++ arrays part2
 
C++ arrays part1
C++ arrays part1C++ arrays part1
C++ arrays part1
 
Introduction to network
Introduction to networkIntroduction to network
Introduction to network
 
Flow control in c++
Flow control in c++Flow control in c++
Flow control in c++
 
Oops And C++ Fundamentals
Oops And C++ FundamentalsOops And C++ Fundamentals
Oops And C++ Fundamentals
 
Text mode Linux Installation Part 01
Text mode Linux Installation Part 01Text mode Linux Installation Part 01
Text mode Linux Installation Part 01
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 

Pointer in c++ part1

  • 2.  A pointer is a variable that holds a memory address. That’s it.  This is what the difference in between variable and pointer. ◦ Pointer holds the address ◦ Variable holds the value.
  • 3. Computer memory is divided into sequentially numbered memory locations. Each variable is located at a unique location in memory, known as its address. Memory representation
  • 4.  Thecapability to use pointers and manipulate memory at a low level is one of the factors that makes C++ the language of choice for embedded and real-time applications.
  • 5. Different computers number this memory using different complex schemes.  We must happy, as a programmer, We don’t need to know the particular address of any given variable because the compiler handles the details.  If we want this information, though, you can use the address-of operator (&), which returns the address of an object in memory.
  • 6.
  • 7. It is so simple to declare a pointer. We need the type of the pointer  Next the name of the pointer.  When we declare a pointer variable such as pointer, the compiler sets aside enough memory to hold an address int *pointer;
  • 8. A pointer that is not initialized is called a wild pointer because you have no idea what it is pointing to.  If you want to initialize you can as like we do for variable. int *intPointer = 0;  A pointer whose value is zero is called a null pointer.  All pointers, when they are created, should be initialized to something.
  • 9. Every variable has an address. Even without knowing the specific address, you can store a variable’s address in a pointer. Declaring pointer Passing address
  • 10. Holds the value Holds the address
  • 11. Type must be same to the variable whose address is going to pass to the pointer.  When you want to pass the address of the variable use (&) before the variable name.  When you want to pass the value use (*) before the pointer.