Can anyone please elaborate the meaning of "Macro in c "??? is that same one which is in excel?? one line meaning of macro pls... and yes another thing... a working program of Multidimensional array..( more than three or four pls..) thanks...
I don't really know the science behind the macro, but they can be used to streamline tasks; You can do quite a bit with them, but they're also sneaky if you're not careful with them. A basic example might be to print the ascii character along with its dec, oct, and hex values. Code: #include <stdio.h> #include <ctype.h> #define MYPRINT(x) \ if(isprint(x)) \ printf("ASCII %c; DEC %d; OCT %o HEX %x\n", (x),(x),(x),(x)) int main(void) { int i; for(i=0; i < 128; ++i) MYPRINT(i); getchar(); return 0; } for the 2d array, they're no different from a single dimension really. You've got the number of rows and a number of columns in each row. Code: int arr[5][5]; // 2d array with 5 rows and 5 cols row 0; col 0-4 arr[0][0] = 0; arr[0][1] = 0; arr[0][2] = 0; arr[0][3] = 0; arr[0][4] = 0; row 1; col 0-4 arr[1][0] = 1; arr[1][1] = 1; arr[1][2] = 1; arr[1][3] = 1; arr[1][4] = 1; ... for(row=0; row < max_row; ++row) { for(col=0; col < max_col; ++col) // do something some_2d_array[row][col] } // maybe read values into the array int row, col, some_2d_array[3][5]; for(row=0; row < 3; ++row) { for(col=0; col < 5; ++col) scanf("%d", &some_2d_array[row][col]); } Don't let extra dimensions confuse you; this bit is really no different than a set of single dimension arrays capable of holding 3, 4, 5, and 6 elements individually. Code: arr[3][4][5][6]; arr[0-2][0-3][0-4][0-5] arr[1st][2nd][3rd][4th] for(1st = 0 through 2) for(2nd = 0 through 3) for(3rd = 0 through 4) for(4th = 0 through 5) arr[1st][2nd][3rd][4th] = some_value;