fork download
  1. #include <iostream>
  2. using namespace std;
  3. struct node{
  4. node *l,*r; int k;
  5. };
  6.  
  7. void alter_wrong(node *x){x=NULL;}
  8. void alter_correct(node **x){*x=NULL;}
  9. int main(){
  10. node *root=new node;
  11. alter_wrong(root);
  12. cout<<(root==NULL)<<endl;
  13. alter_correct(&root);
  14. cout<<(root==NULL)<<endl;
  15. return 0;
  16. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
0
1