C++11 NULL与nullptr

tech2022-08-28  113

#include"stdafx.h" #include<stdio.h> void foo(char* a) {     int c = 10;     printf("666"); } void foo(int) {     int b = 10;     printf("777"); } int main01() {     char* p = NULL;     foo(NULL);//NUll为0,传入的参数相当于为int型的     foo(nullptr);//nullptr表示空指针,本质还是0,但是具备了类型。     //nullptr=(char *)NULL;     return 0; }

最新回复(0)