Infinite loop (do - while) -


for(int m=0;m<=3;m++){     for(int n=0;n<=3;n++){         if(n>0){             int c =n,t=1;             do{                 t = up_key_no0(&puzz[c][m]);                 c--;             }while(t==1||c>=0);         }     } } int up_key_no0(int *puzy){     int *puzx = puzy -4;     int down = *puzy;     int = *puzx;     if(((down==up)||(up==0))&&down!=0){         *puzx += *puzy;         *puzy=0;         return 1;     }     else{         return 0;     } } 

is following piece of code wrong? if yes reply. whole code cant fit puzz 2 dimensional array of 4x4

your do-while loop can go out of range of table negative indices when t 1 , c 0. maybe should change condition (t == 1 && c >= 0) (and instead of or).


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -