Bug #17286 2010-06-21 07:16
argentwolf
perhaps big-array's worry
CB in my computer use MinGW. In my code,I want print a matrix as follow: 1 3 4 10 2 5 9 11 6 8 12 15 7 13 14 16 when the length of side growth to 34 or longer,the binary will print as 1 2 ... 3 ... ... when i use TC compiled it,the binary is right. I tried to use MinGW in command mode to compile my code,result also worry. I don't know why... My code: #include <stdio.h> #include<conio.h> #define N 34 int main(void) { int a[N][N],i=0,j=0,count,*p=*a; for(count=0; count<N*N; count++,p++) *p=0; for(i=0,j=0,count=0; count<N*N; count++) { a[i][j]=count+1; if(((i+1==N||j-1<0)||(a[i+1][j-1]!=0))&&((i-1>=0&&j+1<N)&&a[i-1][j+1]==0)) i--,j++; else if(((i-1<0&&j+1<N)||a[i-1][j+1]!=0)&&((i+1<N&&j-1>=0)&&a[i+1][j-1]==0)) i++,j--; else if((j-1<0&&i+1!=N&&a[i-1][j+1]!=0)||(j+1==N&&a[i+1][j-1]!=0)) i++; else if((i-1<0||a[i+1][j-1]!=0)||(i+1==N&&a[i-1][j+1]!=0)) j++; } for(i=0; i<N; i++) { for(j=0; j<N; j++) printf("%4d",a[i][j]); printf("\n"); } getch(); return 0; }
- Category
- Compiler
- Group
- Status
- Closed
- Close date
- 2010-08-24 22:42
- Assigned to
- jenslody
History
ID_54638 2010-07-08 16:51
That sounds like a compiler-specific bug, or a bug in your code (I have not tested which is problematic); however neither of those are of concern to Code::Blocks. Code::Blocks is just an IDE, not a compiler: if you are sure that this is a bug in MinGW please report it to them, not us.
jenslody 2010-08-24 22:42
Not a C::B issue.
Either code or compiler related.