调试技巧:assert 宏

来源:互联网 发布:python openstack开发 编辑:程序博客网 时间:2024/06/02 00:16

assert 

/* assert example */#include <stdio.h>      /* printf */#include <assert.h>     /* assert */void print_number(int* myInt) {  assert (myInt!=NULL);  printf ("%d\n",*myInt);}int main (){  int a=10;  int * b = NULL;  int * c = NULL;  b=&a;  print_number (b);  print_number (c);  return 0;}


0 0