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


Groups > comp.programming > #1904

Re: repeating something n times

From Ike Naar <ike@sverige.freeshell.org>
Newsgroups comp.programming
Subject Re: repeating something n times
Date 2012-07-06 12:57 +0000
Organization A noiseless patient Spider
Message-ID <slrn3vfsjvdo5f.9li.ike@sverige.freeshell.org> (permalink)
References <repeat-20120705210751@ram.dialup.fu-berlin.de> <jt6kvi$7ah$1@dont-email.me>

Show all headers | View raw


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.

Back to comp.programming | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

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

csiph-web