cpp null pointer code example
Example 1: null c++
//NULL is equal to 0
#include <iostream>
using namespace std;
int main(){
int x = NULL;
int y = 0;
cout << y << endl; // Outputs 0
cout << x << endl; // Outputs 0
return 0;
}
Example 2: SET TO NULL pointer c++
*ptr=NULL; /*or*/ *ptr=0;