string assignment in C

George Kyriazis kyriazis at rpics
Fri Oct 14 00:36:23 AEST 1988


In article <6777 at chinet.chi.il.us> john at chinet.chi.il.us (John Mundt) writes:
>  ... stuff deleted ...
>Each string,
>"first" and " is:" are reserved by the compiler as unnamed strings
>somewhere in memory. ......

My question is:  Are strings like " is:" volatile or not?
When you say p2 = " is:", are you sure that the string will remain in
memory or the optimizer will decide to put something else there since
the string is basically a constant used only once??
I also have the idea that if you say
        p1 = "abc";
        p2 = "abc";
p1 and p2 will have different value, since the strings are not the same
(they have the same contents, but physically should be different).
Is that a right assumption?



  George Kyriazis
  kyriazis at turing.cs.rpi.edu
------------------------------



More information about the Comp.lang.c mailing list