compiler fails to know the type of memory to be pointed to (int,
char...etc.) by p... thus leading to a runtime error !
the modified code compiles :

int *p;main(){*p=0;}


On Mon, Dec 17, 2012 at 8:51 PM, Saurabh Paliwal <
[email protected]> wrote:

> because p is a dangling pointer and that you can't modify what it's
> pointing to.
>
>
> On Mon, Dec 17, 2012 at 7:10 PM, Shubham Sandeep <
> [email protected]> wrote:
>
>> how does this code achieve SIGSEGV????
>> code:
>>  *p;main(){*p=0;}
>>
>> --
>> Regards,
>> SHUBHAM SANDEEP
>> IT 3rd yr.
>> NIT ALD.
>>
>>  --
>>
>>
>>
>
>
>
> --
>  -    Saurabh Paliwal
>
>        B-Tech. Comp. Science and Engg.
>
>        IIT ROORKEE
>
>  --
>
>
>

-- 


Reply via email to