-
April 21st, 2013, 09:02 PM
#1
Help with Backward function
Can someone please help me with my program it says there is no problem with the build but when exe. it displays a bunch of backward 'k' instead of reversing the words entered.
Problem: Enter in a C-string and use function to display the word backward. (it might help with a pointer but im not sure how to go about it)
lab10_p2.cpp
-
April 22nd, 2013, 01:04 AM
#2
Re: Help with Backward function
Set a break point in the begin of your display function, Press F5 to start debugging, then press F10 for each next step... and look at the debug windows ("Auto", Watch", ...) to see what happens with your variables... Then you'll be able to know what and why goes wrong.
Victor Nijegorodov
-
April 22nd, 2013, 06:16 AM
#3
Re: Help with Backward function
Please post the code here (with code tags) rather than providing a web link. Some of us don't open links from unknown sources so won't be able to provide guidance.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
April 22nd, 2013, 06:24 AM
#4
Re: Help with Backward function
Originally Posted by 2kaud
Please post the code here (with code tags) rather than providing a web link. Some of us don't open links from unknown sources so won't be able to provide guidance.
Well, it is not an external link... It is just the attachment to his/her post.
However, I agree that inserting this code in the OP (with Code tags, of course!) would be much better.
Victor Nijegorodov
-
April 22nd, 2013, 07:16 AM
#5
Re: Help with Backward function
Most of your array is just unitialized garbage. When you reverse the entire array, that's what you see. Your loop should only cover the string that was entered, not the entire buffer.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|