home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 4259 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  57 lines

  1. Path: doc.ic.ac.uk!not-for-mail
  2. From: mdf@doc.ic.ac.uk (Martin Frost)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Referances troubble
  5. Date: 26 Feb 1996 17:07:20 -0000
  6. Organization: Dept. of Computing, Imperial College, University of London, UK.
  7. Distribution: world
  8. Message-ID: <4gspc8$dj4@oak42.doc.ic.ac.uk>
  9. References: <1266.6624T117T1455@himolde.no>
  10. Reply-To: mdf@doc.ic.ac.uk (Martin Frost)
  11. NNTP-Posting-Host: oak42.doc.ic.ac.uk
  12. X-Newsreader: mxrn 6.18-23
  13.  
  14.  
  15. In article <1266.6624T117T1455@himolde.no>, Espen.Berntsen@himolde.no (Nameless) writes:
  16.  
  17. >void Tester(void &Testering)
  18. >{
  19. >    printf("%i\n",Testering);
  20. >    Testering = AllocMem(100, MEMF_CHIP|MEMF_CLEAR);
  21. >    printf("%i\n",Testering);
  22. >}
  23.  
  24. >void main(void)
  25. >{
  26. >    void *Test;
  27. >
  28. >    printf("%i\n",Test);
  29. >    Tester(Test);
  30. >
  31. >    printf("%i\n",Test);
  32. >//   FreeMem(Test, 100);
  33. >}
  34.  
  35. If I understand you correctly, this is the sort of thing you need:
  36.  
  37. void func(void **p1, void **p2)
  38.   {
  39.   printf("%lx,%lx\n",p1,p2);
  40.   p1 = AllocMem(100,MEMF_CHIP|MEMF_CLEAR);
  41.   p2 = AllocMem(200,MEMF_ANY);
  42.   printf("%lx,%lx\n",p1,p2);
  43.   }
  44.  
  45. int main(void)        /* NOTE WELL: main() returns an _int_ */
  46.   {
  47.   void *p1,*p2;
  48.   printf("%lx,%lx\n",p1,p2);
  49.   func(&p1,&p2);
  50.   printf("%lx,%lx\n",p1,p2);
  51.   if(p1) FreeMem(p1,100);
  52.   if(p2) FreeMem(p2,200);
  53.   return(0);
  54.   }
  55.  
  56. Martin
  57.