/* Basic properties of pointers */
#include <stdio.h>

int main() {
	/* A constant string is a pointer to a memory region */
	char *str = "pippo";
	char *c=0; /* A pointer to a character, not initialized */
	int i;
    int a=7;
    int *b, **d;
    b=&a;
    d=&b;
    printf("a=%d (%p)\n", a, &a);
    printf("*b=%d, b=%p (%p)\n", *b, b, &b);
    printf("**c=%d, *c=%p, c=%p (%p)\n", **d, *d, d, &d);


	for(i=0; str[i]!='\0'; i++) {
		printf("%p: %c\n",&str[i], str[i]);
	}
	printf("\n");

	/* Use a pointer to iterate over a string */
	for(c=str; *c!='\0'; c++)
		printf("%p: %c\n", c, *c);
	printf("\n");

	return 0;
}
