I keep getting a read access violation whenever I try to run this code:
#include<stdio.h>
#include<stdlib.h>
int i = 0;
struct basicValues{
float rate, hoursWorked, grossPay, basePay, overtimePay, taxesPaid, netPay;
char name[15];
};
void inputValues (struct basicValues *entered)
{
printf("Please enter your name, hourly pay, and hours worked this week: ");
scanf_s("%s %f %f", entered->name, entered->rate, entered->hoursWorked);
}
void main()
{
int i = 0;
struct basicValues workers[5];
for (i = 0; i < 5; ++i)
{
inputValues(&workers[i]);
printf("%c %f %f", workers[i].name, workers[i].rate, workers[i].hoursWorked);
system("pause");
}
}
I think it has to do with my structure inputValues but I don't know what to change. Thanks