I want to get the username using the stdlib
functio getenv ()
However I always get NULL
here is the code that I have written:
#include<stdio.h>
#include<stdlib.h>
main()
{
char *hai;
printf("The current User name is\n");
hai="USER";
printf("%s\n",getenv(hai));
exit(0);
}
Does the value that getenv ()
returns depends on the machine that you are using to compile your code, and why the value returned is NULL
?