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 Chriss Miller 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
Joined
Nov 11, 2001
Messages
1
Location
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.

Similar threads

Part and Inventory Search

Sponsor

Back
Top