Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > reverse string, how to print string and not decimals?

Reply
Thread Tools

reverse string, how to print string and not decimals?

 
 
Martin Ambuhl
Guest
Posts: n/a
 
      08-07-2008
Nick Keighley wrote:
> On 7 Aug, 11:42, "Chris M. Thomasson" <(E-Mail Removed)> wrote:
>> "Richard" <(E-Mail Removed)> wrote in message


>>> Calm down Bwian.

>> Its Brian right? If so, why misspell his name on purpose? Seems quite odd
>> indeed...

>
> <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.
 
Reply With Quote
 
 
 
 
Default User
Guest
Posts: n/a
 
      08-07-2008
Mark B [Diputsur] wrote:

>
> "Nick Keighley" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed).


> > but I don't think it
> > addresses the OP's problem he wants to "print string
> > and not decimals". I suspect his printf() format is wrong.

>
> 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
 
Reply With Quote
 
 
 
 
Default User
Guest
Posts: n/a
 
      08-07-2008
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
 
Reply With Quote
 
Mark B [Diputsur]
Guest
Posts: n/a
 
      08-07-2008

"Default User" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Mark B [Diputsur] wrote:
>
>>
>> "Nick Keighley" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed).

>
>> > but I don't think it
>> > addresses the OP's problem he wants to "print string
>> > and not decimals". I suspect his printf() format is wrong.

>>
>> 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.


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


 
Reply With Quote
 
Old Wolf
Guest
Posts: n/a
 
      08-08-2008
On Aug 6, 8:19 am, ssecorp <(E-Mail Removed)> wrote:
> 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[i];
> }
> 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.
 
Reply With Quote
 
Mark B (Diputsur)
Guest
Posts: n/a
 
      08-08-2008
On Aug 7, 9:26*pm, Old Wolf <(E-Mail Removed)> wrote:
> On Aug 6, 8:19 am, ssecorp <(E-Mail Removed)> wrote:
>
> > 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[i];
> > * * *}
> > * * *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
 
Reply With Quote
 
Old Wolf
Guest
Posts: n/a
 
      08-08-2008
On Aug 8, 2:16 pm, "Mark B (Diputsur)" <(E-Mail Removed)> wrote:
> 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.
 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      08-08-2008
Mark B [Diputsur] wrote:

>
> "Default User" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Mark B [Diputsur] wrote:
> >
> > >
> >>"Nick Keighley" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed).
> > > com.

> >
> >>> but I don't think it
> >>> addresses the OP's problem he wants to "print string
> >>> and not decimals". I suspect his printf() format is wrong.
> > >
> > > 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.

>
> OMFG, you don't let up!


Just persistent that way! It helps being right and all.

Weren't you supposed to be "done with me"?





Brian
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Re: Reverse and print a string santosh C Programming 2 05-02-2008 10:45 PM
Re: Reverse and print a string Chris Dollin C Programming 3 05-01-2008 03:10 PM
Problem - I want to print Current Output of Pdf file and should print once.I get print dialog box but it is not working keto Java 0 05-30-2007 11:27 AM
Stacks Queues Reverse Reverse Polish dogbite C++ 4 10-10-2003 05:06 AM



Advertisments