C++中void*,NULL和nullptr

  • 在C语言中
    #define NULL((void*)0)
  • 在C++语言中

#ifndef NULL
#ifdef_cplusplus
#define NULL 0
#else
#define NULL((void*)0)
#endif
#endif

  • 在C++11中,nullptr用来代替(void*)0,NULL只表示0;

猜你喜欢

转载自blog.csdn.net/yasuofenglei/article/details/108596916