⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sort.c

📁 nachos test nachos 有关实验
💻 C
字号:
/* sort.c  *    Test program to sort a large number of integers. * *    Intention is to stress virtual memory system. * *    Ideally, we could read the unsorted array off of the file system, *	and store the result back to the file system! */#include "syscall.h"int A[1024];	/* size of physical memory; with code, we'll run out of space!*/intmain(){    int i, j, tmp;    /* first initialize the array, in reverse sorted order */    for (i = 0; i < 1024; i++)		        A[i] = 1024 - i;    /* then sort! */    for (i = 0; i < 1023; i++)        for (j = i; j < (1023 - i); j++)	   if (A[j] > A[j + 1]) {	/* out of order -> need to swap ! */	      tmp = A[j];	      A[j] = A[j + 1];	      A[j + 1] = tmp;    	   }    Exit(A[0]);		/* and then we're done -- should be 0! */}

⌨️ 快捷键说明

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