I know there are similar questions, but I still can't figure this out, even though I've been reading for 2 hours.
struct box
{
char letter;
int occupied; //0 false, 1 true.
};
void fill(struct box**, int, int, char*); //ERROR HERE**
int main(int argc, char** argv)
{
int length=atoi(argv[4]),
width=atoi(argv[5]),
char alphabet[26] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct box soup[length][width];
fill(soup, length, width, alphabet); //HERE**
}
void fill(struct box soup[][], int length, int width, char*alphabet) //AND HERE**
{
//omitted
}
These are the errors I'm getting when I compile:
warning: passing argument 1 of ‘fill’ from incompatible pointer type [enabled by default]
fill(soup, length, width, alphabet);
^
note: expected ‘struct box **’ but argument is of type ‘struct box (*)[(sizetype)(width)]’
void fill(struct box **, int, int, char*);
^
error: array type has incomplete element type
void fill(struct box soup[][], int length, int width, char*alphabet)
^
I don't get why that fails, while some other functions I have like this one, does work:
void wordsToMemory(char**, char*); //prototype
char* dictionary[Nwords];
wordsToMemory(dictionary, argv[1]); //calling the method
void wordsToMemory(char* dictionary[], char* argv) //function body
{
//omitted
}