0

My mario.c compiled and worked fine. But when I try to check it with cs50 check, it gives me these errors:

:) mario.c exists

:( mario.c compiles

\ expected an exit code of 0, not standard error of "mario.c:10:21: error: too many argument..."

:| rejects a height of -1

\ can't check until a frown turns upside down

:| handles a height of 0 correctly

\ can't check until a frown turns upside down

Also please excuse any formatting error in the code, my first time posting here.

My source code is :

#include <cs50.h>
#include <stdio.h> 
int main (void)
{
    int h;
    do
        {
        h = get_int("Height: ");
    }
    while( h > 23 || h < 0);
    for ( int i = 0; i <= h; i++ )
    {
        for ( int a = h-i ; a > 0 ; a-- )
        {
            printf(" ");
        }

        int b;

        for (b = 0 ; b < i ; b++ )
            {
                printf("#");
            }

        printf("  ");

        for (b = 0 ; b < i ; b++ )
            {
                printf("#");
            }

        printf("\n");

    }
}
-1
h = get_int("Height: ");

The use of get_int () is incorrect. According to the definition of the function, does not support arguments:

int get_int(void)

Correct way is:

printf("Heigth: ");
h = get_int();
2
  • 1
    Just a note: the new version of get_int (IDE v99) does support arguments, so it will work in the IDE. HOWEVER, check50 does not, so use the syntax that @MARS suggests. Jul 15 '17 at 14:19
  • @DinoCoderSaurus Yeah it was a bug on their part. Anyway, Thanks for the help both of you
    – Saqib11
    Jul 15 '17 at 16:10

You must log in to answer this question.

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