"parameter name omitted" error message?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lingjun
    New Member
    • Mar 2011
    • 3

    "parameter name omitted" error message?

    Hi,
    I am having problems with this program. I keep on getting the following error messages:


    testing.c: In function `next_month':
    testing.c:25: error: parameter name omitted
    testing.c:27: error: syntax error before "mnth"

    My code is:
    Code:
    #include <stdio.h>
    
    enum month {jan=0, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec};
    
    typedef enum month mnth;
    
    mnth next_month(int);
    
    int main(void) 
    {
    int x;
    mnth k;
    
    printf("Enter. ");
    scanf("%d", x);
    
    k = (next_month(x));
    
    printf("%s", k);
    
    return 0;
    
    
    
    mnth next_month(int)
    { 
    return ((mnth) (((int) mnth +1 % 12));
    }
    Thanks!
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    line 25 you define an int parameter without naming it (only C++ and C99(?) can have anonymous parameters).

    Then at line 27 you treat the type mnth as though it is a variable when you try mnth + 1

    Comment

    • donbock
      Recognized Expert Top Contributor
      • Mar 2008
      • 2427

      #3
      You are missing the closing bracket for the main function.

      Comment

      Working...