int main(void)
{
	int a[] = { 1, 2, 3, };
	int b[] = { 4, 5, 6, };
	int c[] = { 7, 8, 9, };
	int *d[] = { a, b, c, };
	struct NumMatrix *mat = NumMatrixCreate(d, 3, 3);
	printf("%d\n", sumRegion(mat, 1, 1, 2, 2));
	NumMatrixFree(mat);
}
Esempio n. 2
0
int main()
{
    printf("Hello world!\n");

    // Your NumMatrix object will be instantiated and called as such:
    int matrix[4][4] = {{1,2,3,4},{5,6,7,8},{1,2,3,4},{1,2,3,4}};
    struct NumMatrix* numMatrix = NumMatrixCreate(matrix, 4, 4);
    sumRegion(numMatrix, 0, 1, 2, 3);
    sumRegion(numMatrix, 1, 2, 3, 4);
    NumMatrixFree(numMatrix);

    return 0;
}