Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!think!ames!sdcsvax!nosc!cod!murphys From: murphys@cod.UUCP (Steven P. Murphy) Newsgroups: comp.lang.c Subject: Two dimensional arrays in C Message-ID: <733@cod.UUCP> Date: Mon, 22-Jun-87 20:18:53 EDT Article-I.D.: cod.733 Posted: Mon Jun 22 20:18:53 1987 Date-Received: Wed, 24-Jun-87 00:38:43 EDT Organization: Naval Ocean Systems Center, San Diego Lines: 61 Keywords: ? The following example is what I would like to be able to do. Is it possible ? I tried something like this twice but it didn't work either time, though it be from my inexperience with C. #define ROWS1 500 #define COLUMNS1 30 #define ROWS2 400 #define COLUMNS2 20 main() { static double data1[ROWS][COLUMNS]; static double data2[ROWS][COLUMNS]; int n, m; n1 = 300; m1 = 15; n2 = 200; m2 = 18; . . . matrix_stuff(n1, m1, data1, ROWS1, COLUMNS1); . . . matrix_stuff(n2, m2, data2, ROWS2, COLUMNS2); . . . } /* end of main */ matrix_stuff(a, b, array, x, y); int a, b, x, y; double array[x][y]; { int i, j; . . . for(i = 0;i <= a;i++) /* step through the rows */ for(j = 0;j <= b;j++) /* step through the columns */ { operate on the part of the matrix "array" that was used in main } . . . } /* end of matrix_stuff */