fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct TestStruct{};
  5.  
  6. class TestClass
  7. {
  8. public:
  9. TestClass() : testStruct1(nullptr) {}
  10.  
  11. TestStruct* testStruct1;
  12. TestStruct* testStruct2{nullptr};
  13. TestStruct* testStruct3 = nullptr;
  14. };
  15.  
  16. int main()
  17. {
  18. TestClass c;
  19.  
  20. if ( c.testStruct1 == NULL )
  21. cout << "Is NULL" << endl;
  22.  
  23. if ( c.testStruct2 == NULL )
  24. cout << "Is NULL" << endl;
  25.  
  26. if ( c.testStruct3 == NULL )
  27. cout << "Is NULL" << endl;
  28. return 0;
  29. }
  30.  
  31.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
Is NULL
Is NULL
Is NULL