how to manipulate trees using C