Good, I have a problem with a program where I have a matrix [N] [N] where N is 9000 but when I run the program I peta.
The question is this: The values of M (square matrix of size NxN, being N = 9000) not null will be generated pseudo-randomly and will be comprised between 0
Code:
#include <stdio.h>
#include <stdlib.h>
#define N 9000
int main()
{
int **matriz;
int i,j;
// Reserva de Memoria
matriz = (int **)malloc(N*sizeof(int*));
for (i=0;i<=N;i++)
matriz[i] = (int*)malloc(N*sizeof(int));
rellenarMatriz(matriz);
//imprimir(matriz);
system("pause");
return 0;
}
void rellenarMatriz(int **matriz[][N])
{
int i,j;
srand(time(NULL));
for(i=0;i<N;i++){
for(j=0;j<N;j++){
if(i==j)
{
matriz[i][j] = 0;
}
else{
matriz[i][j] = rand()%10;
}
}
}
}
The error is as follows