Re: string operation??
- From: Random832 <random@xxxxxxxxxxxxx>
- Date: 27 Nov 2006 20:23:47 GMT
2006-11-27 <ekffp8$7d2$1@xxxxxxxxxxxxxxxx>,
Christopher Benson-Manica wrote:
mark_bluemel@xxxxxxxxx wrote:
char str[10]="string";
str[0]^=str[1];
Now to the question. In "str[0]^=str[1]" you are not operating on a
string, but on a character in that string. We are doing an exclusive
bitwise or operation with the first two characters and storing the
result in the first. Why the code is doing that is beyond me, though
I'd suspect it was a crude cryptographic technique....
Is it implementation-defined whether the above code yields undefined
behavior or not? (If char is signed, may str[0]^=str[1] not generate
a trap representation?)
Is CHAR_MAX allowed to be a value other than a power of two minus one?
.
- Follow-Ups:
- Re: string operation??
- From: Spiros Bousbouras
- Re: string operation??
- References:
- string operation??
- From: sethukr@xxxxxxxxx
- Re: string operation??
- From: mark_bluemel
- Re: string operation??
- From: Christopher Benson-Manica
- string operation??
- Prev by Date: Urgently required
- Next by Date: Re: Reading a string of unknown size
- Previous by thread: Re: string operation??
- Next by thread: Re: string operation??
- Index(es):
Relevant Pages
|
|