G'day,

I know this is not even C 101 level but would some kind soul please
explain to me why this is not even close to working.

Regards,

Ashley

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int somefunction(char *string1)
{
        char *string2 = "some words\0";

        string1 = (char *)calloc(strlen(string2 + 1), sizeof (char));

        strcpy(string1, string2);

        return 0;
}


int main ()
{
        char *string;

        somefunction(string);

        printf ("\n\nString is: %s\n\n", string);

        free (string);

        return 0;
}


-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to