home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / c / 12787 < prev    next >
Encoding:
Text File  |  1992-08-25  |  1.5 KB  |  45 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!usc!sol.ctr.columbia.edu!ira.uka.de!smurf.sub.org!incom!orfeo!eric
  3. From: eric@orfeo.radig.de (Eric Tuerlings)
  4. Subject: pointer to araay of structs
  5. Message-ID: <BtICrz.5pB@orfeo.radig.de>
  6. Summary: how to use: void (struct aaa (bbb *)[])   ?
  7. Keywords: pointers
  8. Organization: Peter Radig EDV-Beratung, Frankfurt am Main, Germany
  9. Date: Mon, 24 Aug 1992 21:52:46 GMT
  10. Lines: 33
  11.  
  12.  
  13. Hello world,
  14.  
  15. I've encountered a small problem with our (ANSI) Microtec C cross compiler.
  16. See this small piece of code below:
  17.  
  18. struct aaa {
  19.     char y;
  20.     char z;
  21. }
  22.  
  23. void func (struct aaa (*bbb)[])
  24. {
  25.     char z;
  26.  
  27.     z = bbb[3]->ccc;
  28. }
  29.  
  30. in which bbb is a pointer to an array of aaa structures. The compiler
  31. complains about an unknown size. If I give the array a dimension, the
  32. compiler doesn't complain, but that is not what I want. I want func to
  33. handle different array sizes. Ok I know that I simply can leave out the
  34. square brackets, and use some casting in func, but that is not wat I want
  35. too. I like to tell the compiler that func must accept pointers to _arrays_
  36. of aaa structures.
  37.  
  38. I've had contact with the Microtec hot line in Gemany. (Ottobrun/Munich)
  39. Still awaiting their answer, I like to hear from people on the net what they
  40. think about this C problem. It is possible that my C knowledge is the problem.
  41. (At least the lack of it -)
  42. -- 
  43. Eric Tuerlings,Stresemannallee 63,6000 Frankfurt am main(argc,arcv) 70,Germany.
  44. Tel: +49 69 6316870, E-Mail: eric@radig.de ---- Leben wie ein Gott in Frankfurt
  45.