I am getting the syntax error message " ; before type char". I have searched high and low for a missing ";" but everything seems to be in the proper place. It is the last error in my program before a successful compilation.
Please Help!
Thanks!
I am getting the syntax error message " ; before type char". I have searched high and low for a missing ";" but everything seems to be in the proper place. It is the last error in my program before a successful compilation.
Please Help!
Thanks!
Ummm okay let me use my telepaty powers to c ur code throught ur mind !!!!! Post the code if u need a decent reply nun of use is harry porter u c
"I wish i could wish my wishs away"
"By indirections find directions out" -- William Shakespears
"Do what thou wilt shall be the whole of the law" -- Crowley "THE BEAST 666"
Mizra -> love = Death...
RDB(Rocks yooo)..
http://www.cbeginnersunited.com
Are you ready for the Trix ???
It's just a hunch, but see if this is what's wrong
Maybe that's it.Code:#include <stdio.h> int main(void) { int i; i = 2; printf("%d times %d is %d", i, i, i * i); // uncomment int l = 6 and recompile as is // int l = 6; // Trying to create a variable here caused: 'syntax error : missing ';' before 'type' // then try moving int l to the top and try it again. return 0; }
I haven't used a compiler in ages, so please be gentle as I try to reacclimate myself. :P
Thanks guys, my code was this:
void listrecords()
{fileptr=fopen("a:hospital", "r");
char option;
readfile();
.......
It finally dawned on me that my variables had to be declared first before opening the file. DUH!
Now my output has some garbage in it (not from the above problem) I will try to solve that problem tonight. I just stumbled on this board - it is great to know there are people out there who are willing to hear the drivel of a newbie.
Thanks!
The problem is you're trying to use C++ variable declaration in C.
int x = 1;
printf("%d", x );
The above is valid C code. The below is valid C++ code, and is not valid C code:
int x = 1;
printf("%d", x );
int y;
In C, all variable declaration must be at the beginning of the scope block.
Quzah.
Hope is the first step on the road to disappointment.