[C]Why function getenv() return a minus value

2016-2-2 写技术

In the case include no stdlib.h file, the function getenv() return a minus value.

#include <stdio.h>
#include <stdlib.h>
void main(){
	int rc;
	char *env = NULL;
	
	env = getenv("LIB");
	printf("&env = %d \n", env);
	if(env){
		printf("config home:%d\n", env);
	}
	
	env = getenv("HOME");
	printf("&env = %d \n", env);
	if(env){
		printf("home:%s\n", env);
	}
	
}

标签: C

发表评论:

Powered by anycle 湘ICP备15001973号-1