Error: the expression must be a valid left-hand value to change. What does an error mean?
The program must allocate memory for the square matrix
#include<stdlib.h>
bool WidPam(int** X, int str, int sto)
{
if (!(X = (int**)calloc(str, sizeof(int*))))
{
printf("Недостаточно памяти\n");
return false;
}
for (int i = 0; i < str;i++)
{
if (!(/*Курсор стал сюда*/(X + i) = (int *)calloc(sto, sizeof(int))))
{
printf("Недостаточно памяти\n");
return false;
}
}
return true;
}
0
1 answers
The error means that the X + i
on the left side of the assignment is nonsense. What were you trying to achieve with your attempt to assign something to X + i
?
The result of the expression X + i
is not an lvalue. You can't assign anything to it.
1
Author: AnT, 2018-10-11 19:48:34