c++ - Code inside loops wont print -


void graph::sortw () {     int length = vertices*vertices;      int array[length];      (int = 0; < length; i++)     {         array[i] = 0;         cout << array[i]; // nothing prints      }     cout << "i";          // convert 1d array      (int = 0; < vertices; i++) {         (int j = 0; j < vertices; j++) {             array[i*vertices+j] = matrix[i][j];              cout << array[i*vertices+j] << " "; // nothing prints          }      }     cout << "j";      qsort(array, length, sizeof(int), compare);       //  (int i=0 ; i<25; i++)     //      cout << array[i] << endl;  // loop prints?!  } 

i have no idea why output ij only. sort called in constructor so:

// sort weights using qsort  sortw();     

anyone have ideas?

i'd suggest put a

cout << vertices; 

at beginning of function. guess ist vertices zero?


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -