hI, Does anyone know why this wont work, All im trying to do is simply sort an array of integers, its based on the bubblesort algorithm from the code snippets section of this site
but the output appearsCode:#include <windows.h> #include <stdlib.h> #include <stdio.h> int A[11]= {12, 5, 7, 2, 56, 20, 43, 8, 31, 33, 14}; int x=0, y=0, n=11; int main(void) { for(x; x<n; x++) { for(y; y<n-1; y++) { if(A[y]>A[y+1]) { int temp = A[y+1]; A[y+1] = A[y]; A[y] = temp; } } printf ("A[%d] = %d\n"); } }
Code:A[4007008] = 4008608 A[4007008] = 4008608 A[4007008] = 4008608 A[4007008] = 4008608 A[4007008] = 4008608 A[4007008] = 4008608 A[4007008] = 4008608 A[4007008] = 4008608 A[4007008] = 4008608 A[4007008] = 4008608 A[4007008] = 4008608![]()



LinkBack URL
About LinkBacks



