Giving runtime error
hi @Jun18APP0112 in your check function, the base case will return ONLY if both root1 and root2 are null, but not if any one of them is NULL. Suppose one of them is null, then the base case will not be executed and we continue to call on the left and right parts. But it is basically like calling NULL->left and that’s why segmentation fault arises.
@Jun18APP0112 you can see the changes here https://ide.codingblocks.com/s/202682
now first condition will be true only if both of them are null. this means that if second condition is true, then only one of them is null and the other is not, so they are not similar.