Hello guys. I would require a little help here in my codings.

The program is basically calculating the parking fare for customers who park their cars in a parking lot.
In function 'void calc_rate(int ,int, int , int ,int,int, int)'
At line 95, it shows a function-definition is not allowed here before '{' token.

/* Question 58 */

#include <stdio.h>
#include <stdlib.h>

// Function Declarations
void getData(void);
void calc_rate(int hourvhcen,int minutevhcen,int hourvhcle,int minutevhcle,int park_timehr,int park_timemin,int park_time_min_round);
int calc_charge(char* vetype, float first_rate, float second_rate, int park_timehr);
void output(int hourvhcen, int minutevhcen, int hourvhcle, int minutevhcle, int park_timehr, int park_time_min_round, float total_charge);

int main(void)
{
    // Local Declarations
    char vetype;
    
    int hourvhcen;
    int minutevhcen;
    int hourvhcle;
    int minutevhcle;
    int park_timehr;
    int park_time_min_round;
    int park_timemin;
    
    float first_rate;
    float second_rate;
    float total_charge;
    
    // Statements
    getData();
    calc_rate(hourvhcen,minutevhcen,hourvhcle,minutevhcle,park_timehr,park_timemin,park_time_min_round);
    calc_charge(&vetype,first_rate,second_rate,park_timehr);
    
    total_charge = first_rate + second_rate;
    output(hourvhcen,minutevhcen,hourvhcle,minutevhcle, park_timehr,park_time_min_round, total_charge);
       
    return 0;
} // main
    
void getData(void)
{
     // Local Declarations
    char vt;
    
    int hvhcen;
    int mvhcen;
    int hvhcle;
    int mvhcle;
    
    //Statements
    printf("\n================================================");
    printf("\n [C] - car, [B] for bus, [T] for truck "); // prompts user to enter their type of vehicle
    printf("\n================================================");
    printf("\nType of vehicle?");
    scanf("%c", &vt);
   
    printf("\nHour vehicle entered lot (0-24)?");
    scanf("%d", &hvhcen);
   
    printf("\nMinute vehicle entered lot (0-60)?");
    scanf("%d", &mvhcen);
   
    printf("\nHour vehicle left lot (0-24)?");
    scanf("%d", &hvhcle);
   
    printf("\nMinute vehicle left lot (0-60)?");
    scanf("%d", &mvhcle);
    
    return;
} // getData
    
void calc_rate(int hourvhcen,int minutevhcen,int hourvhcle,int minutevhcle,int park_timehr,int park_timemin,int park_time_min_round)
{
     // Statements
    if (minutevhcle < minutevhcen) // calculations to round off the minute portion of the leaving and the entering time
    {
       minutevhcle = minutevhcle + 60;
       hourvhcle = hourvhcle - 1;
    }
    
    park_timehr = hourvhcle - hourvhcen;
    park_timemin = minutevhcle - minutevhcen;
    
    if ((park_timemin > 0 && park_timemin <=60))
    {
         {                 
           park_timehr = park_timehr + 1;
           park_time_min_round = park_timemin * 0;
    }                
       
    return;
} // calc_rate
    
int calc_charge(char *vetype, float first_rate, float second_rate, int park_timehr)
{
    // Statements 
    switch (*vetype) // calculates the first and second rate of parking charges which is before 3,2,1 hour and after 3,2,1 hour respectively
    {
           case 'C' :
                if (park_timehr <= 3) 
                {
                   first_rate = 0.00 * park_timehr;
                else
                    second_rate = 1.50 * park_timehr;
                }
    
           case 'T' :
                if (park_timehr <= 2)
                {
                   first_rate = 1.00 * park_timehr;
                else
                    second_rate = 2.30 * park_timehr;
                }
                
           case 'B' :
                if (park_timehr <= 1)
                {
                   first_rate = 2.00 * park_timehr;
                else
                    second_rate = 3.70 * park_timehr;
                }
    }        
    
    return 0;            
} // calc_charge

void output(int hourvhcen, int minutevhcen, int hourvhcle, int minutevhcle, int park_timehr, int park_time_min_round, float total_charge)
{
     // Statements
     printf("\n\t\t PARKING LOT CHARGE \t\t\n");
     printf("\nType of vehicle: Car or Bus or Truck");
     printf("\nTIME-IN\t\t %d : %d", hourvhcen, minutevhcen);
     printf("\nTIME-OUT\t\t %d : %d", hourvhcle, minutevhcle);
     printf("\n\t\t\t --------");
     printf("\nPARKING TIME\t\t %d : %d", park_timehr, park_time_min_round);
     printf("\n\t\t\t --------");     
     printf("\nTOTAL CHARGE\t\t %4.2f", total_charge);
     
     return;
} // output

You opened an extra key '{' in the if statementat the bottom, see the comment i added in the bottom part of the code.

void calc_rate(int hourvhcen,int minutevhcen,int hourvhcle,int minutevhcle,int park_timehr,int park_timemin,int park_time_min_round)
{
     // Statements
    if (minutevhcle < minutevhcen) // calculations to round off the minute portion of the leaving and the entering time
    {
       minutevhcle = minutevhcle + 60;
       hourvhcle = hourvhcle - 1;
    }
 
    park_timehr = hourvhcle - hourvhcen;
    park_timemin = minutevhcle - minutevhcen;
 
    if ((park_timemin > 0 && park_timemin <=60))
    {
         {                 //<----this '{' shouldn't be here 
           park_timehr = park_timehr + 1;
           park_time_min_round = park_timemin * 0;
    }                
 
    return;
} // calc_rate
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.