a part of my code looks like:
unsigned char *J;
unsigned char **arr;
unsigned long rows, cols, i, j;
//number of rows, cols is known.
// arr is treated as double dim array and has some values in it,
// spread in rows and columns given by variables rows, cols
//Now i want to transfer values from arr to J
// i.e 2-Dim to 1-Dim.
// Is this ok ?
J=(unsigned char *)malloc(rows*cols* sizeof(unsigned char));
unsigned long x=0;
*(J+i*cols+j)= arr[i][j]; //or
//*(J+x++) = arr[i][j]; //or
//J[i*cols+j]= arr[i][j] ;
Problem : These loops are not working. Value of i is printed upto 21 and then
it goes berserk, printing some unknown characerers and then
program terminates and even exits IDE without reaching at mesg Done !
What is the problem, what i am doing wrong. Please help.
P.S: Sorry, only 40 points left.