#include <stdio.h> #include <stdlib.h> find(int num[][3], int h, int l, int x){ int i, j; int isFinded = 0; i = 0; j = l - 1; while(i < h && j >= 0){ if(num[i][j] == x){ isFinded = 1; break; } else if(num[i][j] < x) i++; else j--; } if(isFinded == 1) printf("%d %d \n",i, j); else return 0; } main(){ int num[3][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; find(num, 3, 3, 22); }
原文:http://www.cnblogs.com/yutoulck/p/3583876.html