Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. void populate ( int out_array[ ][15] , int *in_r , int *in_c )
  2. {
  3.  int *row;
  4.  int *col;
  5.  row = (int*)malloc(4);
  6.  if(row == NULL)
  7.  {
  8.      printf("Not enough memory available\n");
  9.  }
  10.  col = (int*)malloc(4);
  11.  if(col == NULL)
  12.  {
  13.      printf("Not enough memory available\n");
  14.  }
  15.  *row = 0;
  16.  *col = 0;
  17.  FILE *data;
  18.  data = fopen( "/home/f/csci/urbanc/ghp18.dat" , "r" );
  19.  
  20.  for(*row = 0; *row < *in_r ; *row++)
  21.  {
  22.  for(*col = 0 ; *col < *in_c ; *col++)
  23.  {
  24.  fscanf(data, "%d", &out_array[*row][*col]);
  25.  }
  26.  }
  27.  fclose(data);
  28.  return ;
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement