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:
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:
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"