title: Continue computation in do while even if no columns exist
body: <p>What I am trying to do (not very successful) is if my code detects a signal <code>(if(matrix[i][j] ==1))</code> coming (1 or 0) for the next few steps I want my code to write in a new matrix: <code>newmatrix[i][j]=10</code> and if not to continue with <code>0</code>. Here is my code so far:</p>
  
  <pre><code>    for (i = 0; i &lt; rows; i++) {
          j = 0;
          do {
              if (matrix[i][j] == 1) {
                  int m = j;
                  while (j &lt; m + 3) {
                      newmatrix[i][j] = 10;
                      printf("newmatrix[%i][%i] and %f\n", i, j, newmatrix[i][j]);
                      j++;
                      continue;
                  }
              }
              if (matrix[i][j] == 0) {
                  newmatrix[i][j] = 0;
                  printf("newmatrix[%i][%i] and 0 is %f\n", i, j, newmatrix[i][j]);
                  j++;
                  continue;   
              }
              j++;
          } while (j &lt; MAXTIME);
      }
  }
  </code></pre>
  
  <p>The problem is that if there is a signal near the end instead of stopping when to column count reaches the max number the code inserts new columns even though they are only 10:</p>
  
  <p>Where is my mistake can someone point me to the right direction? Is there maybe a way to do this cleaner with <code>goto</code> statement?</p>