types of pointers n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Types of Pointers PowerPoint Presentation
Download Presentation
Types of Pointers

Loading in 2 Seconds...

play fullscreen
1 / 6

Types of Pointers - PowerPoint PPT Presentation


  • 142 Views
  • Uploaded on

Types of Pointers. An Introduction. Types of Pointers. Generic Pointer NULL Pointer Wild Pointer Dangling Pointer. Generic Pointer. Generic pointer is also known as void pointer. Generic pointer is a special type of pointer which points to the data of no specific data type

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Types of Pointers' - errol


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
types of pointers

Types of Pointers

An Introduction

types of pointers1
Types of Pointers
  • Generic Pointer
  • NULL Pointer
  • Wild Pointer
  • Dangling Pointer
generic pointer
Generic Pointer
  • Generic pointer is also known as void pointer.
  • Generic pointer is a special type of pointer which points to the data of no specific data type
  • For example void *ptr;
  • Here ptr is a generic pointer.
  • We can assign the address of any data type to generic pointer after its declaration.
  • We use generic pointer in two situations. One when we have no idea in advance about the data type of the variable.
  • Secondly when we have to assign the address of different variables of different data types to the single pointer.
null pointers
NULL Pointers
  • It is a special type of pointer which points nowhere.
  • It is usually used to know if the pointer points to null or free the memory during the deallocation of memory in dynamic memory location.
  • For Example: int *ptr= NULL;
wild pointers
Wild Pointers
  • An uninitialization pointer is known as wild pointer.
  • Wild pointer holds a garbage value.
  • It is not pointing any memory location yet.
  • For Example: int *ptr; is a wild pointer.
  • After the initialization it will became an ordinary pointer.
dangling pointers
dangling Pointers
  • It points to a destroyed variable.
  • It usually happens during dynamic memory allocation, when the object is destroyed but not free the pointer, it still pointing to the destroyed variable.
  • For Example: char *dp=malloc(…………) ;

/*………code of the program…………………………

…………code of the program………………………….*/

free(dp);// Now dp is a dengling pointer here.

dp= NULL; // Now dp is not a dengling pointer, it is now a null pointer.