0
#include <cs50.h>
#include <stdio.h>

int main(void)
{
        int height;
    do
    {
        height = get_int("height: ");
    } while (height < 1 || height> 8);


const char block = '#' ;


for (int i = 0; i<10; i++)
{
    printf(block)
}
}

So this is my code, and this is the error message:

mario.c:18:12: error: incompatible integer to pointer conversion passing 'const char' to parameter of type 'const char *'; take the address with & [-Werror,-Wint-conversion]
    printf(block)
           ^~~~~
           &
/usr/include/stdio.h:332:43: note: passing argument to parameter '__format' here
extern int printf (const char *__restrict __format, ...);

not sure what im doing wrong, ive tried printf(%, block) but this isnt right either.

any help appreciated.

2 Answers 2

0

You're passing a single character to printf when it accepts a string. Either change the call from printf to putchar or change the argument you're passing to printf so that you're printing the character formatted as a string

printf("%c", block);
0

you should use printf("%c",block);

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .