Skip to main content

Declaring pointers

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*/

Comments