Declaring Pointers
Pointer is a variable it has to be declared before it can be used.
Syntax: data_type* pointer_name;
data_type is any ‘C’ data type and it indicates the type of the variable that the pointer points to.
(*) is indirection operator
pointer_name is a valid C identifier
Examples:
char *p_ch1,*p_ch2 ; /*p_ch1 and *p_ch2 are pointer to type char */
int *ptr_num; /*ptr_num is a pointer to an integer*/
Also Read
- Static and Dynamic Memory Allocation
- Memory Leak and Dangling Pointer
- Memory Allocation for 2D Array
- Dynamic Memory Allocation
- Pointer Constant and Constant Pointer
- Pointer Declarations and their Meanings
- Functions and Pointers
- Initializing Pointer to Pointer
- Pointer to Pointer Multiple Indirection
- Relationship between Array and Pointer
- Pointer to Array
- Pointer Arithmetic
- Types of Pointer
- Illustrate Basic Pointer Use
- Using Pointer
- Intializing Pointer
- Application of Pointers
- Value Model VS Reference Model
- What is Pointer
Comments
Post a Comment
Please give us feedback through comments