Please tell me how char*arr[4], char *(*ptr)[4]=&arrand (*ptr)[i]mean here step by step.
#include<stdio.h>
int main()
{
int i;
char *arr[4]={"c","c++","java","vba"};
char *(*ptr)[4]=&arr;
for(i=0;i<4;i++)
printf("address of string %d : %u\n",i+1,(*ptr)[i]);
return 0;
}
output:
address of string 1 : 178
address of string 2 : 180
address of string 3 : 184
address of string 4 : 189
and if I change the printf statement:
printf("string %d : %s\n",i+1,(*ptr)[i]);
output:
string 1 = c
string 2 = c++
string 3 = java
string 4 = vba
also give me some links where I can find similar questions for practice.
source
share