On 05/11/2012 05:10 PM, Cristian Rodríguez wrote:
El 11/05/12 15:06, David C. Rankin escribió:
main (int argc, char **argv) {
char * myS1 = "This is the beginning"; char * myS2 = " of my string to test"; char * myS3 = " libc manual concat."; char * result;
Oh, and that does not do what you really mean ;)
Use const char mySn[] = "...."
I will let a known tyrant to explain it for you hehe :) http://gamesfromwithin.com/the-const-nazi
Hmm, Now I'm curious. I have always seen string initializations allowed either way: char *myStr = "blah" or char myStr[] = "blah" To be warned of later attempts to modify constant strings, then the const type modifier is suggested, but I still don't see the difference between: const char *myStr = "blah" or const char myStr[] = "blah" Is there some difference in where/how storage is allocated between the two? Eg. from this example above: const char *myS1 = "This is the beginning"; const char myS2[] = " of my string to test"; const char *myS3 = " libc manual concat."; All seem to do the same thing?? -- David C. Rankin, J.D.,P.E. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org