Error with my function

This is a discussion on Error with my function within the C Programming forums, part of the General Programming Boards category; Here is my function: Code: void Display_Info(clock_num, wage_rate, clock_hours, overtime_hours, gross_pay) { int count; /* Variable used for loop counter ...

  1. #1
    Registered User
    Join Date
    Aug 2012
    Posts
    22

    Talking Error with my function

    Here is my function:
    Code:
     
    void Display_Info(clock_num,  wage_rate, clock_hours,  overtime_hours,  gross_pay)
    {
        int count;     /* Variable used for loop counter */
    
        /* Create table to display employee information */
            printf("\n------------------------------------------------\n");
            printf("Clock#      Wage     Hours     OT      Gross\n");
            printf("------------------------------------------------\n\n");
    
            /* print employee information from arrays into table */
            for (count = 0; count < SIZE; count++)
                printf("%06li     %5.2f    %5.1f   %5.1f    %7.2f\n", clock_num[count] , wage_rate[count] , clock_hours[count] , overtime_hours[count],  gross_pay[count]);
    }
    and here is my call within main
    Code:
     
    Display_Info(clock_num, wage_rate, clock_hours, overtime_hours, gross_pay);
    I am getting subscripted value is neither an array or pointer on line 12. I am not sure what to do and as per directions, I am not to use pointers. How can I fix this?
    Last edited by rpmischris; 10-01-2012 at 10:47 PM.

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,293
    You are missing the parameter types. You should be getting warnings about that.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  3. #3
    Registered User
    Join Date
    Aug 2012
    Posts
    22
    Quote Originally Posted by iMalc View Post
    You are missing the parameter types. You should be getting warnings about that.
    lol what does that mean?

  4. #4
    Registered User
    Join Date
    Aug 2012
    Posts
    22
    lol nevermind.. I just had a severe brain fart.

  5. #5
    Registered User poornaMoksha's Avatar
    Join Date
    Sep 2011
    Location
    India
    Posts
    41
    Code:
    void Display_Info(clock_num,  wage_rate, clock_hours,  overtime_hours,  gross_pay)
    You need to mention the types for all the function parameters in here. Otherwise default types would be assumed by the compiler and probably thats causing the trouble.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Error "in function 'main' syntax error before 'int' Help Please
    By blackhat11907 in forum C Programming
    Replies: 5
    Last Post: 08-20-2011, 07:05 PM
  2. Replies: 8
    Last Post: 07-08-2011, 01:16 PM
  3. Error: _ defined as a function returning a function?
    By Jardon in forum C Programming
    Replies: 15
    Last Post: 07-29-2009, 11:53 AM
  4. function calling within another function error
    By bazzano in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 12:40 AM
  5. getting NOT A FUNCTION error
    By Jay2337 in forum C Programming
    Replies: 2
    Last Post: 03-31-2003, 08:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21