___________________________________________________________
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
/*
PSEUDO DRAW
WRITE BY MIKOXP
*/
int n=15; // range of size n ==>(1,25) display size of the screen
int **tab=NULL; //pointer array
int i,j; //auxiliary
void draw(int **tab,int n)
{
int i,j;
srand( time( NULL ) );
for(i=0;i<n;i++)
for(j=0;j<n;j++)
tab[i][j]=rand()%100;
}
void allocation(int n)
{
int i;
tab=(int**) malloc(n * sizeof(int*));
for(i=0;i<n;i++)
tab[i] = (int*) malloc(sizeof(int) * n);
}
void vision(int n,int **tab)
{
int i,j;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
printf("%d ",tab[i][j]);
printf("\n");
}
}
int main()
{
//allocation memory
allocation(n);
//draw n number from 0 to 99
draw(tab,n);
//verification
vision(n,tab);
system("pause");
return 0;
}
Brak komentarzy:
Prześlij komentarz