Answer the question
In order to leave comments, you need to log in
The expression must be of type object pointer. What is the essence of the error?
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int fillFunction(arr, i, j)
{
for (i = 0; i < 11; i++)
{
for (j = 0; j < 11; j++)
{
arr[i][j] = random(51) - 25; // тут ошибка(i подчеркнуто)
}
}
}
int main()
{
int i, j;
}
Answer the question
In order to leave comments, you need to log in
I have to agree with Illia Nezhyhai - this code is one big mistake :) And the main mistake is that the function parameters have no type, and therefore the compiler assumes that they have the int type (for C, there is no default type in C ++, attempting to compile this code will result in an error). Therefore, of course, the expression arr[i][j] = something there will be incorrect.
Firstly, all function parameters should always be typed - this will save you from such ridiculous mistakes and remind you what is being passed to the function if you don’t write a comment describing it out of your own laziness
Secondly, documenting the passed parameters and assigning normal names to variables, and not i, j, k - will help both others who will read your code, and you yourself - when you get into it in a year.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question