谈计算机对'\0'和null的处理

#include 

int main()
{
	char a = '\0';
	char *p = NULL;

	if (a)
	{
		printf(" '\0' is true\n");
	}

	if (p)
	{
		printf(" 'p' is true\n");
	}

	if (a==0)
	{
		printf(" '\\0' equals zero \n");
	}

	if (p==0)
	{
		printf(" Null equals zero\n");
	}


	//结论: '\\0' equals zero \n , Null equals zero

	return 0;
}

你可能感兴趣的:(c)