vendredi 2 août 2019

How to create a big matrix like with 1000 rows & columns in c?

I wrote a simple code to create a Directed Graph using adjacency matrix with randomly generated numbers that are the vertices of the graph. But my task is to make a bigger matrix with 1000 rows and columns. My code cannot make more than a 50*50 matrix. How can I make a big matrix?

This is the code that I have created.

int arr[1001][1001];
int main()
{
int i,a,b,j,k,m,n;
scanf("%d%d",&a,&b);
for(i=0;i<b;i++)
{
    m=rand()%100;
    n=rand()%100;
    arr[m-1][n-1]=1;
}
for(j=0;j<a;j++)
{
    for(k=0;k<a;k++)
    {
        printf("%d ",arr[j][k]);
    }
    printf("\n");
}

The compiler doesn't give any output.




Aucun commentaire:

Enregistrer un commentaire