From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot) Newsgroups: comp.os.msdos.djgpp Subject: Re: Help with Allegro getpixel() Date: 13 May 1997 23:41:57 GMT Organization: Oxford University, England Message-ID: <5lau85$4ua@news.ox.ac.uk> References: <863525228 DOT 17268 DOT 0 DOT nnrp-2 DOT 9e9829a4 AT news DOT demon DOT co DOT uk> NNTP-Posting-Host: sable.ox.ac.uk Lines: 42 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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 Merton College, Oxford