Array Exercise
That just shows how multidimensional arrays work in C.
#include <stdio.h> #include <conio.h> void main() { int feld[5][5]= { {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0} }; /*Hilfsvariable zur Felddarstellung*/ int x,y; /* Hier setzen wir nu ein paar Werte*/ feld[2][1]=1; feld[3][1]=2; feld[2][2]=3; feld[3][2]=4; /* ab hier geben wir die Werte auf dem Bildschirm aus*/ for(x=0;x<5;x++) { for(y=0;y<5;y++) { printf("%d", feld[x][y]); } printf("\n"); } getch(); }

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Download this code in plain text format here