Results 1 to 3 of 3
#define TRIP 6
#include <stdio.h>
char error_area(char area_code, char S, char M, char L,char N,char P, char K, char R, char C, char U, char W, char O, char T, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-24-2011 #1Just Joined!
- Join Date
- Feb 2011
- Posts
- 1
conflicting type / previous declariation ___ was here
#define TRIP 6
#include <stdio.h>
char error_area(char area_code, char S, char M, char L,char N,char P, char K, char R, char C, char U, char W, char O, char T, char F);
int main(void)
{
char area_code, S, M, L, N, P, K, R, C, U, W, O, T, F, checkB;
char travelarea[TRIP];
printf("Please select from the following that best describes your destination:\n"); /*area code input*/
printf("S Small city - population under 50,000\n"); /*Choices for area code*/
printf("M Medium city - population between 50,000 and 500,000\n");
printf("L Large city - pop. over 500,000\n");
printf("N Natural formation like a mountain, a lake, a cave, a geyser, a fjord, a canyon, etc.\n");
printf("P Designated park or reserve such as a wildlife refuge, a national park, a bioreserve, or a protected marine area\n");
printf("K Man made landmark like the Great Wall of China, the Taj Mahal, or Stonehenge\n");
printf("R State or province or region of a country\n");
printf("C Whole country\n");
printf("U Multiple countries like traveling through Europe\n");
printf("W Ocean voyage\n");
printf("O Any other type of destination - such as visiting the sites of the seven wonders of the world\n");
printf("Please enter the Area Letter code:");
scanf(" %c", &area_code);
travelarea[i]=area_code;
checkB = error_area(area_code, S, M, L, N, P, K, R, C, U, W, O, T, F);
while (checkB == F) /*error loop for error area code*/
{
printf("Please re-enter a valid area_code:");
scanf("% c", &area_code);
checkB = error_area(area_code, S, M, L, N, P, K, R, C, U, W, O, T, F);
if (checkB == T)
{travelarea[i]=area_code;}
}
error_area(area_code, S, M, L, N, P, K, R, C, U, W, O, Z, T, F) /*area code error check*/
{
if ( (area_code == S) || (area_code == M) || (area_code == L) ||(area_code == N) ||(area_code == P) ||(area_code == K) || (area_code == R) ||(area_code == C) || (area_code == U) || (area_code == W) || (area_code == O))
{
return T;
}
else
{
printf("Area code is invalid. (Please make sure code is caplitalize)\n");
return F ;
}
}
I keep getting these area
test2.c:46: error: conflicting types for âerror_areaâ
test2.c:5: error: previous declaration of âerror_areaâ was here
I'm not sure why, I've been going through it and maybe its just I'm not seeing it ( this is C)
- 02-24-2011 #2
In your function declaration, you specify the return type as char. In the function definition below, you don't specify the return type so the compiler assumes the default type: int. Hence the conflict.
"I'm just a little old lady; don't try to dazzle me with jargon!"
- 02-27-2011 #3Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,141
Hazel, I LOVE your so succinct and to-the-point answers!
Great stuff!
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote
