C++ zweidimensionalen Array an Funktion übergeben?

Ja ich weiß das wurde schon hunderte male durchgekaut aber bei Fragen wie dieser geht es meist darum die größe des Arrays zu ermitteln aber mir geht es nur darum den Array zu übergeben und auf ihn zuzugreifen (ich weiß wenn man ihn "normal"(also ohne Zeiger auf ihn)übergibt kann man ihn nicht ändern aber das will ich auch garnicht ich will ihn einfach nur auslesen.(Das ganze soll übrigens mal das spiel des lebens werden)

Hier der Code:

#include<iostream>
#include<windows.h>
using namespace std;
const int x=12; const int y=8;


void ausgeben(char feld[][]){ int j,i;


for(i=0;i<y;i++){


    for(j=0;j<x;j++){


        if(feld[i][j]){             cout<<"#";         }else{             cout<<" ";                         }         }  cout<<endl;


} }


int main(int argc,char* argv[]){ char feld[y][x]{{0,0,1,0,0,0,0,1,0,0,0,0},                 {0,0,1,0,0,0,1,0,0,0,0,0},                 0,0,1,0,,0,1,0,0,0,0,0,0},                 {0,0,1,0,1,0,0,0,0,0,0,0},                 {0,0,1,1,0,0,0,0,0,0,0,0},                 {0,0,1,0,1,0,0,0,0,0,0,0},                 {0,0,1,0,0,1,0,0,0,0,0,0},                 {0,0,1,0,0,0,1,0,0,0,0,0}};


ausgeben(feld);

return 0;
}

Hier die Fehlermeldungen:

||=== Build file: "no target" in "no project" (compiler: unknown) ===|

|8|error: declaration of 'feld' as multidimensional array must have bounds for all dimensions except the first|

||In function 'void ausgeben(...)':|

|15|error: 'feld' was not declared in this scope|

||In function 'int main(int, char)':|

|32|warning: extended initializer lists only available with -std=c++11 or -std=gnu++11|

|39|warning: overflow in implicit constant conversion [-Woverflow]|

|39|warning: overflow in implicit constant conversion [-Woverflow]|

|39|warning: overflow in implicit constant conversion [-Woverflow]|

|39|warning: overflow in implicit constant conversion [-Woverflow]|

|39|warning: overflow in implicit constant conversion [-Woverflow]|

|39|warning: overflow in implicit constant conversion [-Woverflow]|

|39|warning: overflow in implicit constant conversion [-Woverflow]|

|39|warning: overflow in implicit constant conversion [-Woverflow]|

||=== Build failed: 2 error(s), 9 warning(s) (0 minute(s), 1 second(s)) ===|

Und könnte mir jemand noch erklären wie ich die Fehlermeldungen wegbekomme ich verwende Code::Blocks mit dem GNU GCC Compiler ich war schon mal in den entsprechenden Einstellungen allerdings kenne ich mich damit nicht aus und will da nichts verstellen(aber musste ich bereits denn der Compiler verstand Anfangs den neuerern C++ standard nicht obwohl er aktuell ist)

Software, hacken, programmieren, Funktion, Array

Meistgelesene Fragen zum Thema Hacken