#include<stdio.h>
#include<string.h>
int main()
{
        char *s1="hello1" ;
        char *s2="hello2" ;
        {
        strcpy(s1, s2);
        printf("%s\n" , s1);
        }
        }

[EMAIL PROTECTED] ~/CSSp08]$ ./a.out
Segmentation fault (core dumped)

--- On Fri, 7/25/08, Thomas Hruska <[EMAIL PROTECTED]> wrote:
From: Thomas Hruska <[EMAIL PROTECTED]>
Subject: Re: [c-prog] Segmentation fault
To: [email protected]
Date: Friday, July 25, 2008, 8:52 PM










    
            Robert Ryan wrote:

> a question

> 

> --- On Fri, 7/25/08, Thomas Hruska <[EMAIL PROTECTED] .com> wrote:

> From: Thomas Hruska <[EMAIL PROTECTED] .com>

> Subject: Re: [c-prog] Segmentation fault

> To: [EMAIL PROTECTED] com

> Date: Friday, July 25, 2008, 8:06 PM

> 

>             Robert Ryan wrote:

> 

>> Segmentation fault is what!!!! 

> 

> 

> 

> Is that a question or statement?



Well, as a question, a segmentation fault indicates you wrote some piece 

of code incorrectly that caused the application to crash.  Most likely 

your program stepped outside of the bounds of allocated memory and 

attempted to read/write from/to some page of memory your program was not 

allowed to access, an exception occurred, and the OS put a stop to it.



http://en.wikipedia .org/wiki/ Segmentation_ fault



Without actual code, we can't really diagnose your problem further.  You 

should be using a debugger and learning how to use it to solve problems 

such as these (preferably a debugger within an IDE, and also preferably 

the VC++ debugger as it is the BEST debugger on the planet - and 

therefore ideal for beginning programmers) .



-- 

Thomas Hruska

CubicleSoft President

Ph: 517-803-4197



*NEW* MyTaskFocus 1.1

Get on task.  Stay on task.



http://www.CubicleS oft.com/MyTaskFo cus/




      

    
    
        
         
        
        








        


        
        


      

Reply via email to