0

I am new to C, been doing java for a while and i cant figure this out I have an array declared like this

int tabela[visina][sirina];

What im trying to do is feed it to a function that looks like this:

int flood(int i, int j, int trenutna, int zamenjat, int **tabela) {
    tabela[i][j]=zamenjat;
    if (tabela[i+1][j]==0) {
        flood(i+1,j,trenutna,zamenjat,tabela);
    } if (tabela[i-1][j]==0) {
        flood(i-1,j,trenutna,zamenjat,tabela);
    } if (tabela[i][j+1]==0) {
        flood(i,j+1,trenutna,zamenjat,tabela);
    } if (tabela[i][j-1]==0) {
        flood(i,j+1,trenutna,zamenjat,tabela);
    } else {
        return 0;
    }
}

I also call this in an if statement like this

if ((flood(i,j,trenutna,zamenjat,tabela)==0) {
    zamenjat++;
}

What i get is a bunch of warnings that i have no idea how to solve:

passing argument 5 of ‘flood’ from incompatible pointer type 
if ((flood(i,j,trenutna,zamenjat,tabela)==0) {
//if i delete the ( that is too much in here i get a segmentation fault

expected ‘int **’ but argument is of type ‘int (*)[(sizetype)(sirina)]’
Muffin123
  • 41
  • 5
  • what is the function protype of that function and the declaration of that variable `tabela`?? – Karthikeyan.R.S Apr 10 '15 at 12:58
  • How is `int tabela[visina][sirina];` initialized and why? – Iharob Al Asimi Apr 10 '15 at 12:59
  • this is the whole function, there is no prototype, and the declaration of tabela is initialised just like i wrote at the top, i also have a 2 for loops that put everything on 0, and another set of for loops that put in lines of 1s – Muffin123 Apr 10 '15 at 13:04

0 Answers0