Robert Ryan wrote:
> this gives an infinite loop..... Why?
>
> //#include<conio.h>
> #include<stdio.h>
> int main()
> {
> int tr=10,r,c,s, o=1;
> //clrscr();
> for(c=1; c<=tr; r++)
> {
> for(c=1;c<=tr- r;c++)
> {
> printf(" ");
> }
> for(c=1;c<=o; s++)
> printf("c");
> printf("\n") ;
> o=o+2;
> }
> //getch();
> }
Haven't we been over this code before? c is constantly being
reinitialized to 1, various variables are never initialized (you should
be getting compiler warnings all over the place), s is never used yet it
is incremented, and no one has any idea what exactly you are trying to
do in the first place. Stepping through with a debugger will show you
what is going on.
--
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197
*NEW* MyTaskFocus 1.1
Get on task. Stay on task.
http://www.CubicleSoft.com/MyTaskFocus/