Possible Duplicate:
C/C++: Optimization of pointers to string constants
Suppose you have a string "example" defined in a lot of places
// module1.h
char *x = "example";
// module2.h
char *a[] = { "text", "example" };
// module3.c
printf("example");
//etc.
Will this data will be duplicated or will the compiler makes only one reference to it?
It is implementation dependent. But that was the spirit of the immutable property of string literals.
Quoting from the C99 Rationale on string literals: