/* * pointstr1.c */ #include int main(void) { char str[]="Cal"; //declare and initialize string array char * pstr; // declare char pointer pstr=str; // initialze char * pointer to &str[0] printf("\n"); printf("Address of str: %p\n", str); printf("Address of &str[0]: %p \n", &str[0]); printf("Address of pstr: %p \n", pstr); printf("\n"); printf("Address of str[0] is %p == %p\n", &str[0], pstr); printf("Address of str[1] is %p == %p\n", &str[1], pstr+1); printf("Address of str[2] is %p == %p\n", &str[2], pstr+2); printf("Address of str[3] is %p == %p\n", &str[3], pstr+3); printf("Value at str[0] is %c == %c\n", str[0], *pstr); printf("Value at str[1] is %c == %c\n", str[1], *(pstr+1) ); printf("Value at str[2] is %c == %c\n", str[2], *(pstr+2) ); printf("Value at str[3] is %c == %c\n", str[3], *(pstr+3) ); return 0; }