john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

mem size

#include <stdio.h>
/* 10x10 ~52? (2d array of chars, char = approx 1 byte)
   100x100 ~728K (but not until the locations are actually used)
   500x500 ~968K
   1000x1000 ~1,700K
*/

int main()
{
    char buffer[500][500];
    int i=0, k=0;
    printf("hello");

    for(i=0; i<500; i++)
    {
        for(k=0; k<500; k++)
        {
            buffer[i][k]=k;
            printf("%d,%d ",i,k);
        }               
    }
    for(i=0; i<500; i++)
    {
        for(k=0; k<500; k++)
        {
            buffer[i][k]=k;
            printf("%d,%d ",i,k);
        }               
    }
    return 0;

}/* end main */

  • « binary bits
  • file remove linefeed characters »

Published

Feb 6, 2010

Category

c

~56 words

Tags

  • c 95
  • mem 1
  • size 4