home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume8 / graph+ / part03 / newtable.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-03-01  |  725 b   |  40 lines

  1. /*
  2.  * Copyright (C) 1986   Alan Kent
  3.  *
  4.  * Permission is granted to freely distribute part or
  5.  * all of this code as long as it is not for profit
  6.  * and this message is retained in the code.
  7.  *
  8.  * No resposibility is taken for any damage or incorect
  9.  * results this program generates.
  10.  * 
  11.  */
  12.  
  13.  
  14. #include <stdio.h>
  15. #include "graph.h"
  16.  
  17.  
  18. extern char *new ();
  19.  
  20.  
  21. table_st *
  22. new_table ( cols , rows )
  23. int cols , rows;
  24. {
  25.     table_st **pp;
  26.     table_st *newtab;
  27.  
  28.     newtab = NULL;
  29.     pp = &newtab;
  30.     while ( cols-- > 0 ) {
  31.     (*pp) = (table_st *) new ( sizeof ( table_st ) );
  32.     (*pp)->data = (double *) new ( sizeof ( double ) * rows );
  33.     (*pp)->size = rows;
  34.     (*pp)->next = NULL;
  35.     pp = &(*pp)->next;
  36.     }
  37.     return ( newtab );
  38. }
  39.  
  40.