typedef struct _Tree {
struct _Tree *left, *right;
...
} Tree;
int count_nodes(Tree *t)
{
if (t == NULL) return 0;
return 1 + count_nodes(t->left) + count_nodes(t->right);
}
int is_symmetrical(Tree *t) {
if (t == NULL) return 1;
return is_symmetrical(t->left) && is_symmetrical(t->right) && count_nodes(t->left) == count_nodes(t->right);
}