home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18854 < prev    next >
Encoding:
Internet Message Format  |  1992-12-24  |  887 b 

  1. Path: sparky!uunet!wupost!cs.utexas.edu!sun-barr!sh.wide!ascwide!ascgw!cskgw!bigbird!hun
  2. From: hun@bigbird.asro.csk.co.jp (Magyar fiuk)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: System Testing
  5. Message-ID: <1122@bigbird.asro.csk.co.jp>
  6. Date: 24 Dec 92 02:16:02 GMT
  7. References: <gs-310856102441@gs.statlab.uni-heidelberg.de> <1992Dec21.172506.6739@colorado.edu>
  8. Organization: Advanced System Research Organization Ltd. Tokyo, Japan
  9. Lines: 14
  10.  
  11. stasica@alumni.cs.colorado.edu (The Legacy) writes:
  12. >
  13. > void memory_test()
  14. > {
  15. >     int *p, i;
  16.       ^^^
  17. >     p=malloc(8388608);       /* Malloc 8M memory */
  18. >     for (i=0;i<8388600;i++)  /* Write to all 8M 1 char at a time */
  19. >         *(p+i)='\0';  /* BTW this doesn't work....why??? (memory violation)*/
  20.  
  21. Try char instead of int, and cast malloc to char *.
  22. This way *(p+i) means *(p+i*sizeof(int)).
  23.  
  24. Gerzson Szinyei (hun@bigbird.asro.csk.co.jp)
  25.