78 8 C:\Users\User\Desktop\1.c [Error] redefinition of 'file'
41 11 C:\Users\User\Desktop\1.c [Note] previous definition of 'file' was here
От чего может быть?
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
int main(){
int l;
int m = 0, n = 0
, k = 0
, x = 0
, i = 0, j = 0, w = 0;
int** a;
l = getchar();
switch(l)
{
case 'a':
scanf("%d%d%d", &k, &n, &m);
a = (int**)malloc(n * sizeof(int*));
for (i = 0; i < n; i++)
{
a[i] = (int*)malloc(m * sizeof(int));
for (j = 0; j < m; j++) { a[i][j] = 0; }
}
for (w = 0; w < k; ++w)
{
for (i = 0; i < n; i++)
{
for (j = 0; j<m; j++)
{
printf("a[%d][%d] = ", i, j);
scanf("%d", &x);
a[i][j] += x;
}
}
}
printf("\nsumm: \n");
FILE* file = fopen("file.txt", "w");
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) {
fprintf(file, "%d %d ", i, j);
}
fclose(file);
}
return 0;
case 'b':
scanf("%d%d%d", &k, &n, &m);
a = (int**)malloc(n * sizeof(int*));
for (i = 0; i < n; i++)
{
a[i] = (int*)malloc(m * sizeof(int));
for (j = 0; j < m; j++) { a[i][j] = 0; }
}
for (w = 0; w < k; ++w)
{
for (i = 0; i < n; i++) //строки
{
for (j = 0; j<m; j++)
{
printf("a[%d][%d] = ", i, j);
scanf("%d", &x); //считываем значение матрицы
a[i][j] += x;
}
}
}
printf("\nsumm: \n");
FILE* file = fopen("file.txt", "w");
for (j = 0; j < n; j++) {
for (i = 0; i < m; i++) {
fprintf(file, "%d %d ", i, j);
}
fclose(file);
return 0;
}
}
}