Well, but just point a little thing about it, and help you see some of
these points I'm starting to think right now (the first time I ever
think about it):
If you replaced the semicolon between second and third, that's the
second semicolon, you write:
for(i =3D 0; cp =3D msg, *(cp + i); i++)
It would be better
for(i =3D 0, cp =3D msg; *(cp + i); i++)
since in the body of the for loop you're not modifying the value of cp
(if you do so and want the second statement form then the first would be
better, so it would restore cp =3D msg for each cycle), but here you don'=
t
modify it, so it willl be constant for all the loops.
The for loops work this way: The first field is executed in the first
place the first cycle and no more, the second field is executed once for
every loop at the first place (or after the first if it's the first
loop) and the third loop executes at the last moment for every cycle.
If you use the first form you're doing the assigment every cycle, which
would give a performance penalty (I don't know at all how much it can be
noticed or not), with the second you're doing it just the first time and
no more, which is the best since you don't need repeat it.
Danny Austin escribi=F3:
>
> Hey CarlosGarciadel MonteI realized something didn't seem right with 4
> expressions but the book had it written out that way so I went with it
> thinking maybe it was something I hadn't seen before. Well anyway by
> taking out the semi colon and replacing with the comma between what
> was the second and third expressions making them both one expression
> made it work as advertised.
> ThanksDanny
> You misspelled the statement, the first semicolon is a comma (,) so
> you
> have a first field with two assignments, the second with a condition
> and
> the third with the operation.
|