int was not declared in another function

#include <iostream>
#include <fstream>

using namespace std;

struct stac
{
int r, g, b;
int x, y;
int dx, dy;
};
struct galinis //galine spalva
{
int r=255;
int g=255;
int b=255;
int poz=0;
//255 255 255 -balta, pati pradzia
};
void skaitymas(int &n, stac s[], int piesinys[][])
{
ifstream fin ("U2.txt");

fin >> n;

for(int i=0; i<n; i++)
{
fin >>s[i].x >>s[i].y;
fin >>s[i].dx >> s[i].dy;
fin >> s[i].r >>s[i].g >>s[i].b;

for(int a=s[i].x; a<s[i].dx; a++)
{
for(int b=s[i].y; b<s[i].dy; b++)
piesinys[a][b]=1;
}
}
fin.close();
}
int main()
{
int n;
int piesinys[100][100]={0};

stac s[100];
galinis g[100][100]; //galines kubeliu spalvos, tarsi zemelapis

skaitymas(n, s, piesinys);


for(int i=0; i<100; i++)
{
for(int j=0; j<100; j++)
{
cout <<piesinys[i][j] << " ";
}
cout << endl;
}
return 0;
}
I do not get what is the problem here, maybe I just don't see something, bet yeah...
1.
Please learn to use code tags, they make reading and commenting on source code MUCH easier.

How to use code tags: http://www.cplusplus.com/articles/jEywvCM9/

There are other tags available.

How to use tags: http://www.cplusplus.com/articles/z13hAqkS/

HINT: you can edit your post and add code tags.

Some formatting & indentation would not hurt either

2. With Visual Studio 2022 I get an entirely different error:
E0098 an array may not have elements of this type (line 20)

Line 20 in VS is: void skaitymas(int& n, stac s[], int piesinys[][])
2D arrays have to have at least the 2nd dimension explicitly declared. Since you are declaring the 2D array as int piesinys[100][100] at line 43 in main your function declaration should be
void skaitymas(int& n, stac s[], int piesinys[][100]).
Even better would be void skaitymas(int& n, stac s[], int piesinys[100][100]).

https://stackoverflow.com/questions/8767166/passing-a-2d-array-to-a-c-function

If you were to use a C++ container such as a std::vector passing a vector won't have this problem.
http://www.cplusplus.com/reference/vector/vector/
Thank you, also I will use them next time, I haven't thought about it that much.

Also, fixing this 2D array problem fixed the other problems. Thanks
Topic archived. No new replies allowed.