I'm trying to run this code and here's the error that i get:
clang -fsanitize=signed-integer-overflow -fsanitize=undefined -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wshadow zeki.c -lcrypt -lcs50 -lm -o zeki
zeki.c:7:1: error: expected identifier or '('
{
I did try removing semicolon after my int main(void), i still got the same error. Any help would be appreciated :)
#include <stdio.h>
#include <stdio.h>
// user will be prompted to give a height for the pyramid. max 15 rows is allowed.
int main(void);
{
int height = get_int();
do
{
printf("How many rows do you want the pyramid to have?\n");
}
while (height < 0 || height > 15);
for (int i = 0, i < height, i++ )
{
// print spaces to the left of the blocks.
int space1 = height - 1;
for (int j = 0; j < space1; space1--);
{
printf(" ");
}
// print blocks in the middle.
int block = 0;
for (block < i + 1; block++)
{
printf("#")
}
// print spaces to the right of the blocks.
int space2 = height - 1;
for (int j = 0; j < space2; space2--)
{
printf(" ");
}
printf("\n");
}
}