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

  1. Path: familynews.cycor.ca!usenet
  2. From: gcaine@cycor.ca (gcaine)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Referances troubble
  5. Date: 22 Feb 1996 14:56:26 GMT
  6. Organization: Cycor Communications Inc., Coast to Coast Internet Services
  7. Message-ID: <1143.6626T526T2599@cycor.ca>
  8. References: <1266.6624T117T1455@himolde.no>
  9. NNTP-Posting-Host: skt-as012.cycor.ca
  10. X-Newsreader: THOR 2.22 (Amiga;TCP/IP)
  11.  
  12.  
  13. >Ok, I have aslight problem with references. The problem is that I have to
  14. >pass a few pointers to a subroutine, where things are done to them, and then
  15. >they are passed back. Now, what I hoped would work was something like this
  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. I'm not sure what your printf's are supposed to print, but I think I know
  36. what you are trying to do.
  37.  
  38. First change Tester to this:
  39.  
  40. void Tester(void *Testering)
  41. {
  42.     printf("%d\n", Testering); /* prints the address of Testering, which 
  43.                                   hasn't been Allocated yet */
  44.                                   
  45.     if (Testering = AllocMem(100, MEMF_CHIP | MEMF_CLEAR))
  46.     {
  47.         printf("%d\n", Testering); /* prints the address of Testering */
  48.         printf("%d\n", &Testering); /* prints the contents of Testering
  49.                                        which is 0 */
  50.     }
  51. }
  52.  
  53. Gary Caine    Member: Team AMIGA
  54.  
  55.