I'm writing a brainfuck interpreter in C, and I'm having a little bit of trouble with the use of somethings I'm not used to. In brainfuck, a comma ( ,) is essentially getchar(). So I have the following code:
//This is just ptr
static char *ptr;
switch (command)
{
case ',':
*ptr=getchar(); // Here's the code causing error
break;
}
gcc throws error: a label can only be part of a statement and a declaration is not a statement
at me when I try to compile this.
Any ideas? (Sorry about this, not so familiar with this error)