Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #1903 > unrolled thread

Re: repeating something n times

Started by"Charles Richmond" <numerist@aquaporin4.com>
First post2012-07-06 07:16 -0500
Last post2012-07-06 12:57 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.programming

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: repeating something n times "Charles Richmond" <numerist@aquaporin4.com> - 2012-07-06 07:16 -0500
    Re: repeating something n times Ike Naar <ike@sverige.freeshell.org> - 2012-07-06 12:57 +0000

#1903 — Re: repeating something n times

From"Charles Richmond" <numerist@aquaporin4.com>
Date2012-07-06 07:16 -0500
SubjectRe: repeating something n times
Message-ID<jt6kvi$7ah$1@dont-email.me>
"Stefan Ram" <ram@zedat.fu-berlin.de> wrote in message 
news:repeat-20120705210751@ram.dialup.fu-berlin.de...
>  It is funny how many languages fail to give a means to
>  repeat something n times.
>
>  In Logo, one can write:
>
> repeat 4
>
>  to repeat something 4 times, but in C one needs
>
> for( int i = 0; i < 3; ++i )
>

In C, you're gonna need:

for(i = 0; i < 4; ++i)

Where "i" is declared earlier.  You can *not* declared "i" as integer... 
within the for() of the statement.  In C++ you can, but *not* in C.

--

numerist at aquaporin4 dot com 

[toc] | [next] | [standalone]


#1904

FromIke Naar <ike@sverige.freeshell.org>
Date2012-07-06 12:57 +0000
Message-ID<slrn3vfsjvdo5f.9li.ike@sverige.freeshell.org>
In reply to#1903
On 2012-07-06, Charles Richmond <numerist@aquaporin4.com> wrote:
> "Stefan Ram" <ram@zedat.fu-berlin.de> wrote in message 
> news:repeat-20120705210751@ram.dialup.fu-berlin.de...
>>  It is funny how many languages fail to give a means to
>>  repeat something n times.
>>
>>  In Logo, one can write:
>>
>> repeat 4
>>
>>  to repeat something 4 times, but in C one needs
>>
>> for( int i = 0; i < 3; ++i )
>>
>
> In C, you're gonna need:
>
> for(i = 0; i < 4; ++i)
>
> Where "i" is declared earlier.  You can *not* declared "i" as integer... 
> within the for() of the statement.  In C++ you can, but *not* in C.

As from the 1999 C standard, you can.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.programming


csiph-web