(10%) Determine
whether the syntax of the following code is correct or not. If it is
correct, predict its output. If it is incorrect, point out the
mistake(s).
/* Binary Tree */
#include <iostream>
struct Node {
char ch;
Node* left;
Node* right;
};
void printTree(Node* p) {
if (p) {
printTree(p->left);
std::cout << p->ch;
printTree(p->right);
}
}
int main()
{
Node G = { 'G', nullptr, nullptr };
Node F = { 'F', nullptr, nullptr };
Node E = { 'E', nullptr, nullptr };
Node D = { 'D', nullptr, nullptr };
Node C = { 'C', &F, &G };
Node B = { 'B', &D, &E };
Node A = { 'A', &B, &C };
printTree(&A);
return 0;
}