[Ilugc] C pgm - Recursive -segmentation fault

  • From: Kannan_Ranganathan@xxxxxxxxxx (Kannan_Ranganathan)
  • Date: Tue Sep 14 11:37:35 2004

Is it  if(*ptr = 5) or if(*ptr == 5)

If its if(*ptr = 5) then any version shld allow this ???

If its if(*ptr == 5) then TC is also not allowing ...


But I do agree with you to a great extent.

Regards 
Kannan 


-----Original Message-----
From: karthick.sundararajan@xxxxxxxxx
[mailto:karthick.sundararajan@xxxxxxxxx] ;
Sent: Tuesday, September 14, 2004 11:29 AM
To: Kannan_Ranganathan; ilugc@xxxxxxxxxxxxx
Subject: RE: [Ilugc] C pgm - Recursive -segmentation fault


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.
************************************************************************** 
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard
is appreciated.
**************************************************************************

Other related posts: