I have this error when try to open this code: An exception was thrown at address 0x7B7EE63C (ucrtbased.dll) in Struct.exe: 0xC0000005: access violation occurred while writing to address 0x0090000
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
using namespace std;
struct automob {
char marka[15];
int year, price;
};
struct automob1 {
char marka1[15];
int year1, price1;
};
int main()
{
FILE *file, *file1;
struct automob a[5];
fopen_s(&file,"file.txt", "w");
for (int i = 0; i < 5; i++)
{
printf("Enter the mark: ");
scanf_s("%s %d %d", a[i].marka, a[i].year, a[i].price);
fprintf(file, "%s %d %d \n", a[i].marka, a[i].year, a[i].price);
}
fclose(file);
fopen_s(&file, "C:\\Users\\tiama\\source\\repos\\Struct\Struct\\file.txt", "w");
printf("Firm bla bla: \n");
return 0;
}