שגיאות בפונקציה
כתבתי פונקציה רקורסיבית האמורה לגלות את המסלול הקצר ביותר של מספרי 1 במטריצה,והיא נראית כך:
כתבתי פונקציה רקורסיבית האמורה לגלות את המסלול הקצר ביותר של מספרי 1 במטריצה,והיא נראית כך:
void mark_matrix (int matr[rows][col], int ro,int colo,int max_ro,int max_colo) { if ((ro==max_ro)&&(col==max_colo)) { matr[ro][colo]=2; } if (matr[ro][colo+1]==1) { if ((colo+1)<=max_colo) { colo+=1; mark_matrix(int matr[rows][col],int ro,int colo,int max_ro,int max_colo); } } if (matr[ro][colo-1]==1) { if ((colo-1)>=0) { colo=colo-1; mark_matrix(int matr[rows][col],int ro,int colo,int max_ro,int max_colo); } } if (matr[ro+1][colo]==1) { if ((ro+1)<=max_ro) { ro=ro+1; mark_matrix(int matr[rows][col],int ro,int colo,int max_ro,int max_colo); } } if (matr[ro-1][colo]==1) { if ((ro-1)>=0) { ro=ro-1; mark_matrix(int matr[rows][col],int ro,int colo,int max_ro,int max_colo); } } }
וחוזרות לי כל הזמן השגיאות הבאות: error C2144: syntax error : missing ')' before type 'int' ו- error C2660: 'mark_matrix' : function does not take 0 parameters לגבי כל if שרשמתי.מישהו נתקל בזה פעם?