#include <stdio.h> #include <stdlib.h> #include <conio.h> #include <math.h> #include <locale.h> #include <iostream> int mass(float a[5][5], int *k) //функция преобразования массива { FILE *f1, *f2; int i, j = *k, n; float b[5][5]; printf("Введите степень\n"); scanf_s("%d", &n); for(i = 0; i < 5; i++) { for(j; j < 5; j++) { fscanf(f1, "%f", &a[i][j]); fclose(f1); b[i][j] = pow(a[i][j], n); printf("%9.0f ", b[i][j]); } printf("\n"); } return i; } void main() { setlocale(LC_ALL, "RUS"); int i, j, k = 0; float c[5][5]; FILE *f1, *f2; f1 = fopen("FILE1.dat", "r"); for(i = 0; i < 5; ++i) for(j = 0; j < 5; ++j) i = mass(c, &k); f2 = fopen("FILE2.dat", "w"); fclose(f2); } The idea is this: the original data is read from one file and written to another. And there is no record. Here is a mistake:
Unhandled exception in "0x7c90100b" in "lab1.exe": 0xC0000005: Access violation when reading "0xcccccd00".
I can not understand why, what is the error.