#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	printf("--编译器测试--\n");
	printf("NULL是否为空指针？\n");
	printf("NULL：%d, addr=%p\n", NULL, NULL);
	
	putchar('\n');
	unsigned long long i = 1, num = 1024;
	printf("1024^5，值应为1125899906842624\n");
	i *= 1024 * 1024 * 1024 * 1024 * 1024;
	printf("运算1 = %llu\n", i);
	i = 1024;
	i *= i * i * i * i;
	printf("运算2 = %llu\n", i);
	i = 1024;
	i *= (unsigned long long)(i * i * i * i);
	printf("运算3 = %llu\n", i);
	i = 1;
	i *= num * num * num * num * num;
	printf("运算4 = %llu\n", i);
	
	
	putchar('\n');
	putchar('\n');
	int *p = calloc(4, sizeof(int));
	void *pp = (void *)p;
	*p = 1;
	printf("指针p指向%p\n", p);
	p++; ++p;
	printf("地址尝试偏移%p\n", p);
	p--; --p;
	printf("地址尝试归位%p\n", p);
	if (!(*p)) {
		printf("归位异常，内存泄露\n");
		p = pp;
		printf("归还内存地址");
		printf("%p\n", p);
	}
	free(p);
	p = NULL;
	pp = NULL;
	
	
	putchar('\n');
	putchar('\n');
	printf("无括号写法测试\n");
	if (0)
		;
	printf("正常\n");
	
	
#if 1
	putchar('\n');
	putchar('\n');
	pp = "";
	printf("段错误检查\n");
	strlen(pp);
	printf("strlen(\"\")完成\n");
	pp = NULL;
	strlen(pp);
	printf("strlen(NULL)竟无段错误\n");
#endif
	
	
	putchar('\n');
	putchar('\n');
	p = "012345";
	printf("报错信息\n");
	printf("释放只读常量区的内存\n");
	free(p);
}
