About **arrays


1
2
3
4
5
6
7
8
9
10
11
12
13
14
double **tmp;
tmp = (double**)malloc(N * sizeof(double*));
for (i = 0; i < N; i++) 
	{
	    tmp[i] = (double*)malloc(N * sizeof(double));
	}
	for (i = 0; i < N ; i++)
	{
		for (j = 0; j < N ; j++)
		{
			printf("%.0lf\n",tmp[i][j]); // I CAN PRINT ALL ELEMENTS
		}
	}
result = (tmp[0][0] * tmp[1][1]) - (tmp[0][1] * tmp[1][0]);// BUT HERE tmp[1][1] gives weird value; 


what is the reason of the problem mentioned in comments? I fill all tmp elements with some values.
Appreciated.
Last edited on
Topic archived. No new replies allowed.