http://www.cplusplus.com/reference/cassert/assert/
声明:void assert (int expression);
1 #include <iostream> 2 #include <cassert> 3 4 using namespace std; 5 6 void cout_number(int *myInt) 7 { 8 assert(NULL != myInt); 9 cout << "myInt===========" << *myInt << endl; 10 } 11 12 int main() 13 { 14 int a = 10; 15 int *b = NULL; 16 int *c = NULL; 17 18 b = &a; 19 cout_number(b); 20 cout_number(c); 21 cout << "Hello World!" << endl; 22 return 0; 23 }