Number Of Page View:100,000+/Months
LOGIN |New User


How pointer variables are initialized ?
There are 2 main ways to initialize pointer vaiables.These are:

1.Static Memory Allocation(SMA)
2.Dynamic Memory Allocation(DMA)

Some initialization of pointer variables are given below:

1.As Datatype:
  We can initialize pointer variables as   datatype *VariableName(Declaration)
e.g. int *ptr,i;

It can be initialized as

2.We can also initialized pointer as:
int i;
int *ptr;
ptr= null;

3.Below I have given a eg for you. This example defines weekdays as an array of pointers to string constants. 

static char *weekdays[ ] =
              "Sun", "Mon", "Tue",  "Wed",
              "Thu", "Fri", "Sat"

Posted By: Name:Rajesh Kr URL: How pointer variables are initialized ?