Here is my code so far:
#include <stdio.h>
#include <cs50.h>
int main(void)
{
int x;
#include <stdio.h>
#include <cs50.h>
int main(void)
{
int x;
printf("Height:");
do
{
x = GetInt();
printf("Height:");
}
while ((x > 23) && (x <= 0));
int i;
for (int i = 0; i < x; i++);
{ printf("\n");
int s;
for (int s = 0; s < x - 1 - i; s++);
{
printf(" ");
}
int h;
for (int h = 0; s + h < i + 2; h++);
{
printf("#");
}
}
}
It won't compile for some reason, here are all the error codes:
clang -fsanitize=integer -fsanitize=undefined -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wshadow mario.c -lcrypt -lcs50 -lm -o mario
mario.c:11:1: error: function definition is not allowed here
{
^
mario.c:47:14: error: declaration shadows a local variable [-Werror,-Wshadow]
for (int i = 0; i < x; i++)
^
mario.c:45:9: note: previous declaration is here
int i;
^
mario.c:50:22: error: declaration shadows a local variable [-Werror,-Wshadow]
for (int s = 0; s < x - 1 - i; s++)
^
mario.c:49:17: note: previous declaration is here
int s;
^
mario.c:55:19: error: declaration shadows a local variable [-Werror,-Wshadow]
for (int h = 0; s + h < i + 2; h++)
^
mario.c:54:14: note: previous declaration is here
int h;
^
mario.c:54:14: error: unused variable 'h' [-Werror,-Wunused-variable]
int h;
^
5 errors generated.
Thanks in advance!