ch07s024.c

来自「稀疏矩阵、链表、图、队列、二叉树、多叉树、排序、遗传算法等的实现」· C语言 代码 · 共 27 行

C
27
字号
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(void)
{
  clock_t start, end;

  unsigned long count = 0;
  start = clock();

  while(malloc(1024))
  {
    ++count;
    if(count % 16 == 0)
    {
      end = clock();

      printf("%7f CPU seconds: %d kilobytes allocated\n",
             (double)(end - start) / CLOCKS_PER_SEC,
             count);
    }
  }
  printf("Out of memory (no more kilobytes).\n");
  return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?