reverse string, how to print string and not decimals?

M

Martin Ambuhl

Nick said:
<sigh> because he's trying to be annoying. ie. he's a troll (some of
the
time).

What is this "some of the time"? There are precious few folks in my
killfile; it takes a consistent history of trolling to get there. He's
definitely there.
 
D

Default User

Mark said:
Fairly obvious that the printf() statement was inserted for
debugging purposes and does not belong in the completed
code.

Except that it formed the basis of what he asked. At any rate, it was
clear he was asking about a different program than the one he posted.
So I didn't waste my time on it, anymore than a mechanic takes a look
as similar car to the one that's malfunctioning.




Brian
 
D

Default User

CBFalconer wrote:

And it is even attracting comment from the twin trolls Richard and
Twink, thus quadrupling the length of the useless thread. If you
keep it up you will probably also attract McCormack. At least they
are plonkable, but we don't really want to plonk you two.


What the hell do I care what trolls think or do? We should refrain from
posting because the trolls might respond? If you choose not to plonk
trolls, that's not exactly my responsibility.





Brian
 
M

Mark B [Diputsur]

Default User said:
Except that it formed the basis of what he asked. At any rate, it was
clear he was asking about a different program than the one he posted.
So I didn't waste my time on it, anymore than a mechanic takes a look
as similar car to the one that's malfunctioning.

OMFG, you don't let up!
A better analogy would be one taking his car to the mechanic for a
misfire and mentioning he couldn't determine which cylinder was bad
because he couldn't get his timing light to work. You're the asshole
that refused to look at the car until he brings you the timing light!!!

For someone concerned with wasting time, you seem to be doing
an awful lot of time wasting lately. Next time take the extra second
initially rather than hurrying to be first to post, as doing so makes it
apparent that programming is not one of your strong suits. :)

Mark
 
O

Old Wolf

char* reverse(char* str) {
int length = strlen(str);
char* acc[length];
int i;
for (i=0; i<=length-1; i++){
acc[length-1-i] = str;
}
return acc;

}


Something nobody has mentioned yet (despite
there being 47 replies already) - you try to
return the address of a local array, that
will no longer exist once the function returns.

If you want to return a string then you will
have to be more careful about allocating
memory for it.
 
M

Mark B (Diputsur)

char* reverse(char* str) {
     int length = strlen(str);
     char* acc[length];
     int i;
     for (i=0; i<=length-1; i++){
         acc[length-1-i] = str;
     }
     return acc;


Something nobody has mentioned yet (despite
there being 47 replies already) - you try to
return the address of a local array, that
will no longer exist once the function returns.

If you want to return a string then you will
have to be more careful about allocating
memory for it.


Hey! I know you!

Might want to read a few of those 47 replies...
it's been mentioned numerous times ;-)
 
O

Old Wolf

Hey! I know you!

Might want to read a few of those 47 replies...
it's been mentioned numerous times ;-)

True, I skipped over half of the thread
where it looked like everybody was
bickering about irrelevant crap.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top