~/CSSp08]$ ./a.out
hello2hello2
is this what the output is suppose to be

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


--- On Sat, 7/26/08, Paul Herring <[EMAIL PROTECTED]> wrote:
From: Paul Herring <[EMAIL PROTECTED]>
Subject: Re: [c-prog] Segmentation fault
To: [email protected]
Date: Saturday, July 26, 2008, 2:22 PM










    
            On Sat, Jul 26, 2008 at 5:52 PM, Robert Ryan <[EMAIL PROTECTED] 
com> wrote:

>

> #include<stdio. h>

> #include<string. h>

> int main()

> {

>         char *s1[7]="hello1" ;     // 5



char s1[7] = "hello1";



You're actually defining an array of pointers, when you want to define

an array of chars. And the number in [] is superflous in this context.



-- 

PJH



'Two Dead in Baghdad' not 'product-friendly' - Kent Ertugrul, chief

executive of Phorm.



http://shabbleland. myminicity. com


      

    
    
        
         
        
        








        


        
        


      

[Non-text portions of this message have been removed]

Reply via email to