someone told me the problem which occurs when the number of zeilen(rows?) is increased to above 4.
**matrix is itself an array where every element points to an array. every element has to be large enough to store an address, which on a 64bit system is of course 8-byte long. so the line:
matrix=(int **)malloc(zeile*sizeof(int))
is too small to hold all the addresses. (sizeof(int) is only 4-bytes large). this can be cured by
a/ finding something 8bytes large to go in sizeof(int)
or
b/ writing it explicitly: matrix=(int **)malloc(zeile*8);
or
c/ being crafty and making sure the computer checks how long the pointer has to be, for example:
i/ matrix=(int **)malloc(zeile*sizeof(int*));
or
ii/
int main()
{
...
int *ptr;
...
matrix=(int **)malloc(zeile*sizeof(ptr));
...
}
which would make pretty general code one could use everywhere, i suppose.
thanks for your help
hold