I find this interesting.

This piece of code
---------------------------------------
char* somefunction()
{
       char *string2 = "some words";
       return string2;
}
---------------------------------------
works, but this piece of code
-----------------------------
char* somefunction()
{
       char string2[] = "some words";
       return string2;
}
--------------------------------------
doesn't


char *string2 = "some words\0";
   string1 = (char *)calloc(strlen(string2 + 1), sizeof (char));

strlen (string2 + 1) = strlen ("ome words");

why do you want to do that?

Now don't flame, I am a newb with 2-3 years commercial C/C++ experience, I am
entitled to suck.


yiz

--
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