J Wang wrote:
[color=blue]
> the c code as follows:
>
> #include <stdio.h>
> #include <stdlib.h>
>
> int main()
> {
> printf("%s\n", getenv("NAME")) ;
> return 0;
> }
>
> Segmentation Fault
>
> why?
>[/color]
Perhaps "NAME" is not defined in the environment, so getenv() returns
NULL and your attempt to dereference it is illegal. We just had this a
couple of days ago. That you did not see it shows that you violated
usenet etiqutte by posting without following the newsgroup first. You
probably didn't check the FAQ either.
Comment