F
F
fewgesto2021-12-20 19:58:17
C++ / C#
fewgesto, 2021-12-20 19:58:17

Why is the id not defined?

#include <stdio.h>
#pragma warning(disable : 4996)
int wannazachet(int matr[n][n], int i, int j) {	
  for (int o = 0; o < n; o++) {
    for (int l = 0; l < n; l++) {
      printf("%d ", matr[o][l]);
    }
    printf("\n");
  }
}
int main() {
  int i = 0, j = 0, n = 0, o = 0, l = 0, d = 0;
  int matr[99][99], a[99], matr1[99][99];
  scanf("%d", &n);
  scanf("%d %d", &i, &j);
  for (int o = 0; o < n; o++) {
    for (l = 0; l < n; l++) {
      scanf("%d", &matr[o][l]);
    }
  }
  wannazachet(matr[n][n], i, j);	
}

writes to the int wannazachet(int matr[n][n], int i, int j)index n is not defined why....?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-12-20
@fewgesto

Because at the moment the function is defined, no n exists. And it doesn't make n sense in this context.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question