Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Unhappy 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);

    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)

    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;
    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)

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Harrow, UK
    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!"

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    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!

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts