Error type of formal parameter 1 is incomplete

The error: type of formal parameter 1 is incomplete means you have not mentioned the second (column) dimension of a 2D array

In C, it is necessary to mention the second(column)dimension, whereas the first dimension(row) is optional

So, that means you should always mention the second (column) dimension during function declaration or initializing a 2D array to avoid error

Let’s see an example

#include <stdio.h>
#include <stdlib.h>
void display(int q[][],int,int);
int main()
{
    int a[3][4]={{1,2,3,4},{5,6,7,8},{9,0,1,6}};
    display(a,3,4);
    return 0;
}
// function declaration Without mentioning  the second(column)dimension of a 2D array
void display(int q[][],int row, int col)
{
    int i, j;
    for (i=0;i<row;i++)
    {
        for(j=0;j<col;j++)
        printf("%d",q[i][j]);
        printf("\n");
    }
    printf("\n");
}

As can be seen, from the above code the second (column) dimension is missing in the function declaration

It is illegal omit the second (column) dimension and because, of that such errors are produced

Finally, the error can be fixed by simply mentioning the second (column) dimension of a 2D array during function declaration

#include <stdio.h>
#include <stdlib.h>
void display(int q[][4],int,int);
int main()
{
    int a[3][4]={{1,2,3,4},{5,6,7,8},{9,0,1,6}};
    display(a,3,4);
    return 0;
}
// function declaration Without mentioning  the second(column)dimension of a 2D array
void display(int q[][4],int row, int col)
{
    int i, j;
    for (i=0;i<row;i++)
    {
        for(j=0;j<col;j++)
        printf("%d",q[i][j]);
        printf("\n");
    }
    printf("\n");
}

Mohammed Anees

Hey there, welcome to aneescraftsmanship I am Mohammed Anees an independent developer/blogger. I like to share and discuss the craft with others plus the things which I have learned because I believe that through discussion and sharing a new world opens up

Leave a Reply

Your email address will not be published.