On 2 Dec 2010 at 23:30, Dave McGuire wrote:
On Dec 2, 2010, at 10:28 PM, blstuart at
bellsouth.net
wrote:
That's
interesting as a puzzle, but I've seen the converse:
"0123456789abcdef"[i]
in the wild. I'm pretty sure it was in some of Ken's code.
I've done that a few times.
How about:
#define s "0123456789'
int i;
for (i = 0; i < 10; i++)
s[i] = 'x';
printf( "%s\n", s);
A lot of compilers will accept this without a whimper. What you get
on output depends on whether or not the compiler "pools" literal
constants--and whether or not the literal is stored in a memory
segment with read-only permissions.
--Chuck