Salve a tutti: ho un problema con questo codice
#include <stdio.h>
#include <iostream>
#include <fstream>
using namespace std;
void carica(int m[][], int &r, int &c);
void stampa(int m[][], int r, int c);
int main(int argc, char **argv)
{
int m[40][40];
int r, c;
carica(m,r,c);
stampa(m,r,c);
return 0;
}
void carica(int m[][], int &r, int &c)
{
cout<<"inserisci il numero di righe: ";
cin>>r;
cout<<"inserisci il numero di colonne: ";
cin>>c;
cout<<endl;
for(int i=0; i<r; i++)
for(int j=0; j<c; j++)
{
cout<<"inserisci un numero: ";
cin>>[i][j];
}
}
void stampa(int m[][], int r, int c)
{
for(int i=0; i<r; i++)
{
for(int j=0; j<c; j++)
{
cout<<[i][j]<<" ";
}
cout<<endl;
}
}
non riesco a capire che sto sbagliando mi da 10 errori:
C:\Windows\system32\cmd.exe /C "C:/TDM-GCC-64/bin/mingw32-make.exe -j4 SHELL=cmd.exe -e -f Makefile"
"----------Building project:[ filenome - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Users//Desktop/Gabriele/LinguaggioC/filenome'
C:/TDM-GCC-64/bin/g++.exe -c
"C:/Users/Desktop/Gabriele/LinguaggioC/filenome/main.cpp" -g -O0 -Wall -o ./Debug/main.cpp.o -I. -I.
C:/Users/Desktop/Gabriele/LinguaggioC/filenome/main.cpp:5:21: error: declaration of 'm' as multidimensional array must have bounds for all dimensions except the first
void carica(int m[][], int &r, int &c);
^
C:/Users/Desktop/Gabriele/LinguaggioC/filenome/main.cpp:5:22: error: expected ')' before ',' token
void carica(int m[][], int &r, int &c);
^
C:/Users/Desktop/Gabriele/LinguaggioC/filenome/main.cpp:5:24: error: expected unqualified-id before 'int'
void carica(int m[][], int &r, int &c);
^
C:/Users/Desktop/Gabriele/LinguaggioC/filenome/main.cpp:6:21: error: declaration of 'm' as multidimensional array must have bounds for all dimensions except the first
void stampa(int m[][], int r, int c);
^
C:/Users/Desktop/Gabriele/LinguaggioC/filenome/main.cpp:6:22: error: expected ')' before ',' token
void stampa(int m[][], int r, int c);
^
C:/Users/Desktop/Gabriele/LinguaggioC/filenome/main.cpp:6:24: error: expected unqualified-id before 'int'
void stampa(int m[][], int r, int c);
^
C:/Users/Desktop/Gabriele/LinguaggioC/filenome/main.cpp:17:21: error: declaration of 'm' as multidimensional array must have bounds for all dimensions except the first
void carica(int m[][], int &r, int &c)
^
C:/Users/Desktop/Gabriele/LinguaggioC/filenome/main.cpp:17:22: error: expected ')' before ',' token
void carica(int m[][], int &r, int &c)
^
C:/Users/Desktop/Gabriele/LinguaggioC/filenome/main.cpp:17:24: error: expected unqualified-id before 'int'
void carica(int m[][], int &r, int &c)
^
mingw32-make.exe[1]: *** [Debug/main.cpp.o] Error 1
filenome.mk:93: recipe for target 'Debug/main.cpp.o' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/Desktop/Gabriele/LinguaggioC/filenome'
mingw32-make.exe: *** [All] Error 2
Makefile:4: recipe for target 'All' failed
10 errors, 0 warnings
potete gentilmente aiutarmi?