|
From: lordSauron <lor...@gm...> - 2006-01-10 19:31:00
|
On 1/10/06, Per Westermark <pw...@ia...> wrote:
> Short note: "empty" loops are quite common, i.e. all the side effects are
> in the second and third expression.
>
> /Per W
>
> On Tue, 10 Jan 2006 dz...@su... wrote:
>
> > Mr. Lefebvre,
> >
> > In you "for()" loop you left out the "{" & "}" braces
> > defining your loop.
> >
> > Try the following changes listed below. This worked
> > for me.
> >
> > ..Bob
> >
> > #include <stdio.h>
> > #include <stdlib.h>
> >
> > main()
> > {
> > long nc;
> > nc=3D0;
> >
> > for (nc=3D0; getchar()!=3DEOF; ++nc)
> > { //opening brace for "for()" loop.
> > printf("%ld\n",nc);
> > system("Pause");
> > } //closing brace for "for()" loop.
> >
> > return 0;
> > }
Try this:
for (/*whatever you had here.... I'm lazy - srry*/) printf();
instead of for(); printf();, which treats them as seperate statements.
If you want more that one command in the loop, you must use brackets
(unless there's something I don't know about, in which case you will
tell me, right?)
--
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D GCv3.12 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
GCS d-(++) s+: a? C++ UL+>++++ P+
L++ E--- W+(+++) N++ o? K? w--- O? M+
V? PS- PE+ Y-(--) PGP- t+++ 5? X R tv-- b+
DI+++ D+ G e* h- !r !y
=3D=3D=3D=3D=3D=3D=3D=3D=3D END GCv3.12 =3D=3D=3D=3D=3D=3D=3D=3D
|