Definition of pointer

Share on Facebook0Share on Google+4Tweet about this on TwitterShare on LinkedIn0

pinkP“A pointer is a variable that can hold the address of the variables, structures and functions that are used in the program. It contains only the memory location of the variable .

Pointers are used with followings:

  1. Basic data type variable.
  2. Array Subscript variable.
  3. Function names.
  4. Structure and Union names.

Advantages of Pointers:

  1.  Pointers are pointing to different data types and structures.
  2. Manipulation of data at different memory locations is easier.
  3. To achieve a clarity and simplicity
  4. More compact and efficient coding.
  5. To return multiple value via functions.
  6. Dynamic memory allocations.

 Declaring a pointer variable

Pointers are declared similar to normal variables, but we must specify when we declare them what they are going to point to it. We declare a pointer to point to an integer, and then it can’t be used to point a floating-point value etc.

Pointer Operators:

To declare and refer a pointer variable, provides two special operators & and *

  1. Address Operator (ampersand): &
  2. in directional Operator: *
This entry was posted in Software and tagged , , , , , , . Bookmark the permalink.