Only a little trick will do:
Replace:
void add(Ternary* t, string s, int i)
WITH
void add(Ternary*& t, string s, int i)
This is cleaner than passing and then reading the output as follows:
tree = add(tree, "bye", 1);
++ :) C :
void add(Ternary** t, string s, int i)
t .
, ++ :)