Ysa
Ysa

Reputation: 21

Passing argument 4 of 'draw_character' makes pointer from integer without a cast

I keep getting the warnings:

In function 'main': passing argument 4 of 'draw_character' makes pointer from integer without a cast [Note] expected 'char ** (*)[7]' but argument is of type 'char'

but I don't know how to fix these. I would really appreciate your answers :) Here's my program.

int draw_character(int ASCII_Value,int font,int height,char **output_matrix[7][7]);
void print_character(char **output_matrix);

int main(){

char **output_matrix[10][10];
int ASCII_Value = 0,  height = 0;

    printf("DRAW CHARACTER");
    printf("\n\nEnter ASCII Value of the character : ");
    scanf("%d", &ASCII_Value);
    printf("FONT (1 - default or 2 - special): ");
    scanf("%d", &font);
    printf("Height: ");
    scanf("%d", &height);
    draw_character(ASCII_Value, font, height, **output_matrix[7][7]);

return 0;
}

int draw_character(int ASCII_Value,int font,int height,char **output_matrix[7][7]){

int rowsize;

if(font == 1)
{
    height = 5;
    rowsize = 6;
    switch(ASCII_Value)
    {
    case 65:
    case 97:
    strncpy(**output_matrix[0]," *  * ",6);
    strncpy(**output_matrix[1]," *   *",6);
    strncpy(**output_matrix[2],"******",6);
    strncpy(**output_matrix[3],"*     *",6);
    strncpy(**output_matrix[4],"*     *",6);
    print_character(**output_matrix);
    break;

    /*Print B*/
    case 66:
    case 98:
    strncpy(**output_matrix[0],"******",6);
    strncpy(**output_matrix[1],"*    *",6);
    strncpy(**output_matrix[2],"******",6);
    strncpy(**output_matrix[3],"*    *",6);
    strncpy(**output_matrix[4],"******",6);
    print_character(**output_matrix);
    break;

    /*Print C*/
    case 67:
    strncpy(**output_matrix[0]," *****",6);
    strncpy(**output_matrix[1],"*     ",6);
    strncpy(**output_matrix[2],"*     ",6);
    strncpy(**output_matrix[3],"*     ",6);
    strncpy(**output_matrix[4]," *****",6);
    print_character(**output_matrix);
    break;
}
}
return 0;
            }


void print_character(char **output_matrix){
            printf(" %c", &output_matrix);


}

Upvotes: 1

Views: 426

Answers (1)

4pie0
4pie0

Reputation: 29724

You are dereferencing pointer to pointer in

char **output_matrix[10][10];
draw_character(ASCII_Value, font, height, **output_matrix[7][7]);

Instead, pass array:

draw_character(ASCII_Value, font, height, output_matrix);

Upvotes: 1

Related Questions