Tom, I need your help with errors in TC
Re:Tom, I need your help with errors in TC
Hey tom, I included the conio.h file and ran it. It still gave me the same error. So I decided to check the conio.h header file to see if the function getchar was in there. I noticed that it is not in there at all. But there is a getchar function in stdio.h but its a fgetchar and not just getchar.
Any suggestions?
Any suggestions?
Re:Tom, I need your help with errors in TC
Actually, there's a typo in the code, tha you have attached here:
[tt]
int tokentype; /* The type and value of the current token */
char token [MAX_TOKEN + 1];
char look /* Our lookahead character */
/* Heres where Im having the problem.
If a add a semi colon to the end of void GetLook(),
It gives me two errors instead of one. If I add a extra
void in the () after GetLook, it does nothing.
Error Line (25): Declaration Syntax Error */
/* GetLook simply loads look with the next character */
void GetLook() /* This line */
{
look = getchar();
}
[/tt]
If you look at the highlighted code, you'll notice a missing semicolon. Thus, when you eliminate the line breaks and comments, the result is the following declaration:
This probably is the declaration syntax problem you initially reported. It's the kind of thing that leave you tearing your hair out staring at it before you find it. I once spend three weeks trying to find what turned out to be a similiar bug (an incorrectly closed comment, in that case).
[tt]
int tokentype; /* The type and value of the current token */
char token [MAX_TOKEN + 1];
char look /* Our lookahead character */
/* Heres where Im having the problem.
If a add a semi colon to the end of void GetLook(),
It gives me two errors instead of one. If I add a extra
void in the () after GetLook, it does nothing.
Error Line (25): Declaration Syntax Error */
/* GetLook simply loads look with the next character */
void GetLook() /* This line */
{
look = getchar();
}
[/tt]
If you look at the highlighted code, you'll notice a missing semicolon. Thus, when you eliminate the line breaks and comments, the result is the following declaration:
Code: Select all
char look void GetLook() /* This line */
{
look = getchar();
}