The program should allocate memory for a square matrix
# include & lt; stdlib.h & gt;
bool WidPam (int ** X, int str, int sto)
{
if (! (X = (int **) calloc (str, sizeof (int *))))
{
printf ("Not enough memory \ n");
return false;
}
for (int i = 0; i & lt; str; i ++)
{
if (! (/ * The cursor is here * / (X + i) = (int *) calloc (sto, sizeof (int))))
{
printf ("Not enough memory \ n");
return false;
}
}
return true;
}
Answer 1, authority 100%
The error means that the X + i
on the left side of the assignment is nonsense. What were you trying to achieve by your trying to assign something in X + i
?
The result of the expression X + i
is not an lvalue. You cannot assign anything to it.