Path: utzoo!attcan!uunet!snorkelwacker!usc!cs.utexas.edu!uwm.edu!csd4.csd.uwm.edu!duncan From: duncan@csd4.csd.uwm.edu (Shan D Duncan) Newsgroups: comp.sys.amiga.tech Subject: C help and the amiga Message-ID: <3087@uwm.edu> Date: 26 Mar 90 17:27:27 GMT Sender: news@uwm.edu Reply-To: duncan@csd4.csd.uwm.edu (Shan D Duncan) Organization: University of Wisconsin - Milw. Biol. Sci. Dept. Lines: 114 Preface: New to C I have a little c program to rearrange some data. it works fine on our unix machine (berkeley) but has problems on my amiga. First what I am doing.: I have files of ascii data - integers. The data is actually a matrix 128 rows by 200 or 300 colum. The data was originally written as so: 1 2 3 4 5 6 7 8 9 But should be represented as 3 6 9 2 5 8 1 4 7 After I look at the matrix I then need to put it in row form: 1 4 7 2 5 8 3 6 9 So I just used an array of arrays - scan %d into the array and printf %d out. Works fine on unix but if I try it on my amiga I get very large negative numbers or very large numbers mixed in with the data... unless I declare it static but if I do THAT then I can only have an array size of 128 by 125. So here is the code: Instruct me! #include #define ROWS 128 #define COLS 200 void main () { int i,j, INDATA[COLS][ROWS]; for ( i = 0; i < COLS; i++ ) { for (j=0; j < ROWS;j++) scanf ("%d ",&INDATA[i][j]); } printf("%d %d\n",COLS,ROWS); \* just prints out row and cols *\ for (i =1 ; i < COLS+1; i++) printf("%d\n",i); \* counts cols *\ for (j = 1 ; j < ROWS+1; j++) printf("%d\n",j); \* counts rows *\ for ( j=0; j < ROWS; j++) { for (i = 0; i < COLS ;i++) printf ("%d \n ",INDATA[i][j]); } } The file using my little array of above 3 3 1 2 3 1 2 3 1 4 7 2 5 8 3 6 9 I wanted something I could use on both my amiga and our unix system... I just sent the code to a friend with a C compiler (Lattice I believe) and he compiled it for me. I probably have a conceptual here since I am used to thinking (and looking) at this stuff in rows and columns. Oh the resulting file then goes into threedplot a program from the fish disks (the 2d part is now multiplot). So alternatively if someones has a 3d plotting program (net type plot) that can use a matrix of x y and z data PLEASE let me know! Thanks for any and all comments, advice, instruction, code, kinder and gentler criticism... but please educate.