If a variable is going to be a pointer, it must be declared as such. A pointer declaration consists of a base type, an *, and the variable name.
The general form for declaring a pointer variable is :
Variable type *pointer name;
Eg-
int *j ;
where type is the base type of the pointer and may be any valid type. The name of the pointer variable is specified by name.
The base type of the pointer defines the type of object to which the pointer will point. All pointer operations are done relative to the pointer's base type. For example, when you declare a pointer to be of type int *, the compiler assumes that any address that it holds points to an integer.
\* Pointer to initialize and print the value and address of variable. *\
# include < stdio.h >
int main( )
{
int x = 99 ;
int *p1 ;
p1 = &x ;
printf("Values at p1: %d ", *p1) ;
printf("Addresses pointed to by p1: %p ", p1) ;
return ( 0 );
}
Values at p1: 99
Addresses pointed to by p1: 003645980