#include<stdio.h>
#include <stdlib.h>
#include <time.h>
#include<conio.h>
const int LOW = 1;
const int HIGH = 150;
int main()
{
int grid[30][30]={0},x,j,i,die;
int data_points, tempx, tempy;
for(x=0;x<150;x++)
{
tempx = rand() % 30 + 1;
tempy = rand() % 30 + 1;
data_points = rand() % (HIGH - LOW + 1) + LOW;
grid[tempx][tempy]=data_points;
printf("%d\n",data_points);
}
for(i=0;i<30;i++){
for(j=0;j<30;j++){
printf("x=%d\t y=%d\t index=%d\n",i,j,grid[i][j]);
}}
getch();
}
when we run this program we get the value for the grid[j].In this as we are generating the values randomly by the rand function.So we may get more than one value at some point in the grid[j] but the values are getting overwritten.Can anyone help in implementing linked lists to this concept and trying to get more values for the grid[j].
Hoping a positive reply