Hello,
I'm compiling with Dev-c++ 4.01.
I'm trying to capture a six digit alphanumeric zipcode
with this routine; which comes from a mailing list program.
The compiler is reporting one error:"Parse error at end of
input." I must be missing a curly brace or two, but i can't
find where to put them.
I'm aware of other problems in the program, e.g. true/false
statements; but for now I just want this program to compile
and run.
Here's my code:
I'm compiling with Dev-c++ 4.01.
I'm trying to capture a six digit alphanumeric zipcode
with this routine; which comes from a mailing list program.
The compiler is reporting one error:"Parse error at end of
input." I must be missing a curly brace or two, but i can't
find where to put them.
I'm aware of other problems in the program, e.g. true/false
statements; but for now I just want this program to compile
and run.
Here's my code:
Code:
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
/*Prototype*/
char err_msg(char err_msg[]);
char getzip(char zipcode[]);
int main();
int main()
{
char err_msg(char err_msg[];
printf("\n\n%s\n", err_msg);
fflush(stdout);
return;
}
char getzip(char zipcode[])
{
int ctr, ch, false, true;
char getzip(char zipcode[7]); /*extra null character.*/
do
{
ch = 0;
printf("What is the ZIPcode?");
fgets(zipcode, 7, stdin);
for(ctr = 0; ctr < 6; ctr ++)
{
zipcode[ctr] = toupper(zipcode [ctr]);
if((ctr % 2)== 0)
{
if(! isalpha(zipcode [ctr]))
{
return false;
}
else
{
if(! isdigit(zipcode [ctr]))
{
return false;
}
return true;
}
}
else
{
err_msg("The ZIPcode must be alphanumeric only");
ch = 1;
break;
}
}
while (ch);
system("PAUSE");
return;
}