Mail Archives: djgpp/1997/05/13/23:48:19
BDC Client Team (cs19 AT cityscape DOT co DOT uk) wrote:
: for (y1=0; y1++; y1<32)
: {
: for (x1=0; x1++; x1<32)
: {
: p=getpixel(s2,x1,y1);
: if ((p!=0) && (p!=-1))
: {
: sprintf(msg,"Colour=%d\n", p);
: textout(screen, font, msg,0,0+(10*y1),38);
: }
: }
: }
:
: Any ideas anyone?
Yes, you got the for statements the wrong way around. for statements work
like this:
for (initialisation;test;action) do_something;
means
initialisation;
while (test) {
do_something;
action;
}
where initialisation, test, action and do_something are
expressions/statements. Normally you write:
for (x=0;x<10;x++) printf("x=%d\n",x);
You had the test and action the wrong way around.
HTH
--
George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Merton College, Oxford
- Raw text -