Question: Rubin [Rub87] used the following example (rewritten here in C) to argue in favor of a goto statement: The intent of the code is to
Rubin [Rub87] used the following example (rewritten here in C) to argue in favor of a goto statement:
![int first_zero_row = -1; int i, j; /* none */ for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (A[i] [j]) goto next; } first_zero_row = i; break; next: ; }](https://dsd5zvtm8ll6.cloudfront.net/si.question.images/images/question_images/1606/1/9/7/1795fbc9fbb414bd1606197179634.jpg)
The intent of the code is to find the first all-zero row, if any, of an n × n matrix. Do you find the example convincing? Is there a good structured alternative in C? In any language?
int first_zero_row = -1; int i, j; /* none */ for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (A[i] [j]) goto next; } first_zero_row = i; break; next: ; }
Step by Step Solution
3.28 Rating (163 Votes )
There are 3 Steps involved in it
Heres a possible solution in C If C a... View full answer
Get step-by-step solutions from verified subject matter experts
