home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18783 < prev    next >
Encoding:
Text File  |  1992-12-22  |  1015 b   |  34 lines

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!kuhub.cc.ukans.edu!nrlvx1.nrl.navy.mil!powalisz
  2. Newsgroups: comp.lang.c
  3. Subject: Sparse arrays..ARGH!
  4. Message-ID: <1992Dec22.120553.893@nrlvx1.nrl.navy.mil>
  5. From: powalisz@nrlvx1.nrl.navy.mil
  6. Date: 22 Dec 92 12:05:53 -0400
  7. Organization: NRL SPACE SYSTEMS DIVISION
  8. Lines: 24
  9.  
  10. I have a question about Sparse Arrays:
  11.  
  12. If the array elements are declared as structs:
  13.  
  14. struct sparse{
  15.               int col;
  16.               int row;
  17.               int val;
  18.               struct sparse *nextcol;
  19.               struct sparse *nextrow;
  20.               } 
  21.  
  22. how can I return 'val' recursively and return 0 if there is no element at that
  23. row and column. The function prototype desired is:
  24.  
  25. retreive(struct sparse *a, int *col, int * row)
  26.  
  27. Yes, this was part of a question I had on afinal exam, and I was wondering what 
  28. the solution was, since I know I didn't have the correct one.
  29.  
  30. Please respond via this newsgroup to give other users the knowledge, too.
  31.  
  32. Ron Powalisz
  33.  
  34.