Skip to content

Instantly share code, notes, and snippets.

@Azim
Created Oct 19, 2017
Embed
What would you like to do?
Generate random array in C/c++
int array[MAX_ROWS][MAX_COLS];
srand(time(NULL));
printf("\n j j j j j");
for(int i=0;i<MAX_ROWS;i=i+1){
printf("\n \n i ");
for(int j=0;j<MAX_COLS;j=j+1){
array[i][j]=rand();
if(array[i][j]<10000){
array[i][j]+=10000;
}
printf("%d ",array[i][j]);
}
}
printf("\n");
@Azim
Copy link
Author

Azim commented Oct 19, 2017

Output:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment