Hello all,
i tried the given code snippet and found 'null' output both the time
...
compiled and run using gcc (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)
...
Regards,
Ajit Mote.
On Wed, Jun 18, 2008 at 3:22 PM, Wang Yu <[EMAIL PROTECTED]> wrote:
> Hi, all
> I have the following code:
> #include
> <stdio.h>
>
> int
> main()
>
> {
>
>
>
> char
> *p;
>
> p =
> 0;
>
> *printf("%s",
> p);
>
> printf("\n"); *
>
> return
> 0;
>
> }
>
> The out put is *(null)*
> But, if I change into:
>
> #include
> <stdio.h>
>
>
> int
> main()
>
> {
>
>
>
> char
> *p;
>
> p =
> 0;
>
> * printf("%s\n", p); *
>
>
> return
> 0;
>
> }
>
> The output will be* Segment fault*!
>
> I don't know why....
> Thanks!
> --
> National Research Center for Intelligent Computing Systems
> Institute of Computing Technology, Chinese Academy of Sciences