I'm trying to retrieve an input from the user and then apply it to the portion of mario.c
that makes prints the pyramid. After several hours of trial and error, here is what I have been able to come up with so far:
#include <stdio.h>
#include <cs50.h>
int main(void);
int (n);
int n = GetInt();
do
{
n = GetInt();
}
while (n !> 0 && n !< 23)
for (int i = 0; i < n; i++)
{
printf ("##");
}
When I attempt to compile this program, I get the following errors:
mario.c:7:9: error: initializer element is not a compile-time constant
int n = GetInt();
^~~~~~~~
mario.c:9:1: error: expected identifier or '('
do
^
mario.c:13:1: error: expected identifier or '('
while (n !> 0 && n !< 23)
^
3 errors generated.
No matter what I do to my code, I always get these three errors, at the very least.
- What is a 'compile-time constant'?
- To what are the 'expected identifier' errors referring?
- What am I doing wrong and what can I do to start debugging?