In my opinion ALL GOTO IS EVIL. If you need them anyway, you'd better consider the Extract Method refactoring.
The need to use "GOTO" is a very good indicator, showing that your method (or function) is too complex for you to divide it into different parts.
For example, this example question can be (and should be) reorganized into:
bool is_zero_row(int *row, int size){ for(i = 0; i<size; ++i){ if(row[i]) return false; } return true; } bool find_zero_row_in_array(int **A, int rows, int row_size){ int i,j; for(i = 0; i < rows; ++i) { if(is_zero_row(A[i], row_size)) return true; } return false; } ... if(find_zero_row_in_array(A, n, n)){
It is much more flexible and readable than the original. At least now we have a function that can work for any arrays with different row and column numbers, but suppose they are the same.
source share