#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main (int argc, char **argv)
{
/* This is the space where STR is allocated the storage string address */
Char **str = (char**) malloc (sizeof (char*) *256);
/* This is the size of the string storage space to which the address in STR is assigned to STR */
*str = (char*) malloc (sizeof (char) *256);
/* Back up the first address of level two pointers */
char **strbak = str;
*STR = "AAA";
/* Print Address */
printf ("addr-str=%p\n", str);
/* Print aaa*/
printf ("*str=%s\n", *str++);
*STR = "BBB";
printf ("addr-str=%p\n", str);
printf ("*str=%s\n", *str++);
*STR = "CCC";
printf ("addr-str=%p\n", str);
printf ("*str=%s\n", *str++);
*str = malloc (32);
printf ("*str=%s\n", *str);
/* Direct copy will report a section error */
strcpy (*str, "ddd");
printf ("sizeof *str=%d\n", sizeof (*STR));
printf ("addr-str=%p\n", str);
printf ("*str=%s\n", *str++);
int i;
for (i=0; i<4; i++)
{
printf ("*strbak=%s\n", *strbak++);
}
return 0;
}