What would be a proper invalid value for a pointer?

前端 未结 7 582
抹茶落季
抹茶落季 2021-01-25 03:16

Suppose I have this code. Your basic \"if the caller doesn\'t provide a value, calculate value\" scenario.

void fun(const char* ptr = NULL)
{
   if (ptr==NULL) {         


        
相关标签:
7条回答
  • 2021-01-25 03:57

    You should use the nullptr for that. Its new in the C++11 standart. Have a look here for some explanation.

    0 讨论(0)
提交回复
热议问题