Sir why we would not check condition for
if(root->left != NULL && root->right != NULL);
sir you direct replace the data and call on delete function?
Deletion in BST
imteyaz save ur code on coding block online ide and share the link here of which u r taking about we will look into it