[Ilugc] C pgm - Recursive -segmentation fault

  • From: karthick.sundararajan@xxxxxxxxx (karthick.sundararajan@xxxxxxxxx)
  • Date: Tue Sep 14 11:29:08 2004


Please don't believe TC for segmentation faults. It is not reliable in
segmentation faults area. Try this code:
#include <stdio.h>

void main()
{
        int *ptr = (int*)0;

        if(*ptr = 5)
        {
                printf("It worked");
        }
}

        To the best of my knowledge it works more times than not.

        I think that is because DOS gives the whole of the avaibale
memory for the program under execution.

        Also, the best that can be expected is that TC will get closed
in such cases.

        Cheers,
        Karthick S.
        Mobile Number: 9884025911
        Home Page: www.geocities.com/sksatyam 

(c)-----Original Message-----
(c)From: ilugc-bounces@xxxxxxxxxxxxx
(c)[mailto:ilugc-bounces@xxxxxxxxxxxxx] On Behalf Of Kannan_Ranganathan
(c)Sent: Tuesday, September 14, 2004 11:21
(c)To: ilugc@xxxxxxxxxxxxx
(c)Subject: RE: [Ilugc] C pgm - Recursive -segmentation fault
(c)Importance: High
(c)
(c)
(c)Hi
(c) I did the same thing in office (this time its TC+XP) here too
(c)it seems to
(c)run forever .
(c)
(c)However On my office PC  RH9 gcc3.2.2 it gives a segmentation fault
(c)
(c)
(c)Regards
(c)Kannan
(c)***************************************************************
(c)***********
(c)This email (including any attachments) is intended for the
(c)sole use of the
(c)intended recipient/s and may contain material that is CONFIDENTIAL
AND
(c)PRIVATE COMPANY INFORMATION. Any review or reliance by others
(c)or copying or
(c)distribution or forwarding of any or all of the contents in
(c)this message is
(c)STRICTLY PROHIBITED. If you are not the intended recipient,
(c)please contact
(c)the sender by email and delete all copies; your cooperation in
(c)this regard
(c)is appreciated.
(c)***************************************************************
(c)***********
(c) 
(c)
(c)


Confidentiality Notice

The information contained in this electronic message and any attachments to 
this message are intended
for the exclusive use of the addressee(s) and may contain confidential or 
privileged information. If
you are not the intended recipient, please notify the sender at Wipro or 
Mailadmin@xxxxxxxxx immediately
and destroy all copies of this message and any attachments.

Other related posts: