nullptr(null pointer value)
로, 포인터 리터럴(pointer literal)이다.
포인터의 널을 표현한 값이다.
#include <iostream>
using namespace std;
int main()
{
int *ptr1 = 0; // 변수 포인터
int *ptr2 = nullptr;
void (*func1)(int a, int b) = nullptr; // 함수포인터
void (*func2)() = nullptr;
return 0;
}
NULL
은 널을 가리키는 값이 아닌, 숫자 0이다.
ifndef NULL #ifdef __cplusplus #define NULL 0 // cpp null=0 #else #define NULL((void *)0) // c null= ((void *)0) endif