October 26, 2024
Chicago 12, Melborne City, USA
C#

Undeclared Identifier in do while loop, C


#include <stdio.h>
#include <cs50.h>

int main(void)
{
    do
    {
        //ask for input with 1-8
        int height = get_int("Height: ");
    }
    while (height > 0);
}

And I got the error code: use of undeclared identifier "height" (in the while statement)
I’m completely green to programming and I have no idea how to fix this. Can someone help?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video