

it seems we can, but can we do it in a function? lets see. Here is the output: ( read this first) a's value: bf94c204Ī's value is now: bf94c208, same as 'b'. Printf("\n -> value of 'a' is: %x inside function, same as 'f', BUT will it be the same outside of this function? lets see\n", *x) Printf("\n -> value of 'a' is: %x inside function, same as 'f', BUT will it be the same outside of this function? lets see\n", x) Printf("\n a's value is now: %x, YEAH! same as 'f'. Printf("\n NOW! lets see if a pointer to a pointer solution can help us. Printf("\n a's value is now: %x, Doh! same as 'b'. Printf("\n a's value is now: %x, same as 'b'. Printf("\n can we change a?, lets see \n") look at the output below first, to understand. you need a new pointer3 just to point to pointer1. by doing pointer1 = pointer2, you give pointer1 the address of pointer2.īut! if you do that within a function, and you want the result to persist after the function is done, you need do some extra work. but now you want to change that address.Printf("total words in my lol: %d\n", wordsinlol(lol)) Lol = malloc(4 * sizeof *lol) // assume it worked Monologue = malloc(4 * sizeof *monologue) // assume it workedīiography = malloc(4 * sizeof *biography) // assume it workedīiolibrary = malloc(4 * sizeof *biolibrary) // assume it worked Sentence = malloc(4 * sizeof *sentence) // assume it worked Word = malloc(4 * sizeof *word) // assume it worked Usage example with a very very very boring lol #include Yes, I know these might not be the best data structures If you want a list of bio-libraries (a ?lol), you can use char ******lol If you want a list of biographies (a bio-library), you can use char *****biolibrary If you want a list of monologues (a biography), you can use char ****biography If you want a list of sentences (a monologue), you can use char ***monologue

If you want a list of words (a sentence), you can use char **sentence If you want to have a list of characters (a word), you can use char *word
