Re: String reversing problem
- From: "slebetman@xxxxxxxxx" <slebetman@xxxxxxxxx>
- Date: 31 Dec 2005 06:55:03 -0800
Flash Gordon wrote:
> slebetman@xxxxxxxxx wrote:
> > tmp123 wrote:
> >> Hi,
> >>
> >> See inlines:
> >>
> >> Christian Bau wrote:
> >>> tmp123 wrote:
> >>>> To Mr. Christian Bau:
>
> <snip>
>
> >>> {
> >>> char tmp = s [i];
> >> 5) Declare char here, far of the semantically parent of it (char *s) it
> >> is only a way to hide things. And lots of compilers will ignore it (no
> >> new frame).
> >
> > This is correct and valid in C99 (unlike your code which is incorrect
> > and invalid in any C standard). Just because there are no C99 compilers
> > around doesn't mean that this code is not "C".
>
> Actually, you declaring a variable at the start of any block is valid
> for all versions of C.
Oh wow, tested it and it does work. I've always thought that "start of
block" refers to the start of the function. Learn something new
everyday. This is indeed nice as localising scope is usually a "good
thing"(tm).
.
- References:
- String reversing problem
- From: Albert
- Re: String reversing problem
- From: slebetman@xxxxxxxxx
- Re: String reversing problem
- From: pai
- Re: String reversing problem
- From: Chuck F.
- Re: String reversing problem
- From: tmp123
- Re: String reversing problem
- From: Chuck F.
- Re: String reversing problem
- From: tmp123
- Re: String reversing problem
- From: Keith Thompson
- Re: String reversing problem
- From: tmp123
- Re: String reversing problem
- From: Christian Bau
- Re: String reversing problem
- From: tmp123
- Re: String reversing problem
- From: Christian Bau
- Re: String reversing problem
- From: tmp123
- Re: String reversing problem
- From: slebetman@xxxxxxxxx
- Re: String reversing problem
- From: Flash Gordon
- String reversing problem
- Prev by Date: Passing String to Function
- Next by Date: Re: Signal handler for SIGSEGV.
- Previous by thread: Re: String reversing problem
- Next by thread: Re: String reversing problem
- Index(es):