VC小知识

VC在Debug模式下,对堆上申请的内存,都会初始化填充成0xcdcdcdcd(-842150451),目的是为了方便程序员debug,一旦看到0xcdcdcdcd,就表示访问了没有初始化的内存。

#include <cstdio>
#include <malloc.h>

void main()
{
	int *a = (int *) malloc(sizeof(int));
	printf("%x\n", *a);
	int* b = new int;
	printf("%x\n", *b);
}

猜你喜欢

转载自blog.csdn.net/u013404885/article/details/127459034
vc