Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

newbie string question

Status
Not open for further replies.

kosuke

Programmer
Nov 11, 2001
1
US
anyone know how to reverse a string within its own storage space? in other words, reverse it by not using another string for temp storage?

thanks
kosuke
 
hi kosuke,

lemme give u a hint..
u know how to swap variables without a temp variable?
a, b r the ints..
a=aXORb
b=bXORa (b XOR (a XOR b)) = a
a=aXORb ((a XOR b) XOR a) = b !

if strlen is n then every 'i'th character goes to (n-i) position?

hth,
shail
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top