#include #include // an example of a function taking as input a pointer to a pointer. void foo(char ** b) { *b = (char *) malloc(sizeof(char) * 6); (*b)[0] = 'h'; (*b)[1] = 'e'; (*b)[2] = 'l'; (*b)[3] = 'l'; (*b)[4] = 'o'; (*b)[5] = 0; } int main() { char * a = "john"; printf("before calling foo:\n"); printf("a = %s\n\n", a); foo(&a); // note that, in contrast to example7.cpp, the value of a // is different after calling the foo function printf("after calling foo:\n"); printf("a = %s\n", a); }