Is there a function in C that....
Haha. Just kidding
I bet Govtcheez and Quzah are the first to jump all over this thread. Okay, it wasn't that funny...
Is there a function in C that....
Haha. Just kidding
I bet Govtcheez and Quzah are the first to jump all over this thread. Okay, it wasn't that funny...
Judo CHOP!
-Govtcheez
govtcheez03@hotmail.com
i feel so relieved...
for a second i was readying my flame-thrower...
I do it like this
siht ekil ti od I
>>Judo CHOP!
CHOP SALAD! Take that.
Blue
quick and snappy sample:
// note: u can also use sizeof for the original arrayCode:unsigned char original_string[10], reversed_string[10]; // both arrays should be same size for(int x=0;x<10;x++) { reversed_string[x] = original_string[10-x]; }
think only with code.
write only with source.
wait, a std function to reverse a string?
maybe in string.h but I doubt it since I never use it.
check the FAQs board
also, if you want to save memory, change the reverse_string to just an unsigned char and swap values in the array instead.
p.s.: thanks for your reply in the othello thread.
Last edited by toaster; 07-18-2002 at 05:06 PM.
think only with code.
write only with source.
Before you start being all "helpful" (bleh) maybe you should read the thread first?
helpful? me? hah. I seem more like a betrayer than a helper.
I just read the first few lines in posts. I guess I deserved that.
think only with code.
write only with source.
Hehe, that was funny. I was like, "what's that guy doing?"
BTW Toaster, your code indexes outside the array when x is 0
Quidquid latine dictum sit, altum sonatur.
Whatever is said in Latin sounds profound.
oops, I'll check it out.
I suppose you know the error already, right?
" reversed_string[x] = original_string[10-x]; "
lol, how could I have not noticed that?
thanks for the comment.
quick correction: x<10; -> x<(10-1);
Last edited by toaster; 08-05-2002 at 10:49 PM.
think only with code.
write only with source.
Use strrev from string.h. If your compiler impementation doesn't support it ( it's not ANSI), write it yourself![]()
hth
-nv
She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."
When in doubt, read the FAQ.
Then ask a smart question.
/me smacks CShot...
bad yoda, bad. You're lucky I wasn't on here long last nite... i woulda been all over your cheez-attractin ass![]()
EntropySink. You know you have to click it.