I was banging my head with this. I had to look at others solutions to get my code to work. Here is the code I have, it works now but only because I looked at solution. I had this code written minus the highlighted lines. (if and return). I went over the walk through and shorts and lecture over and over and couldnt find this mentioned. I'm not comfortable moving on until I under stand why these lines are needed.
#include <stdio.h>
#include <cs50.h>
int main(void)
{
int x = 0;
do
{
printf("Height:");
x = get_int();
//Why is this needed?
if (x == 0)
{
//Why is this needed?
return 0;
}
}
while (x < 1 || x > 23);
{
printf("####\n");
}
}