Main Page   Compound List   File List   Compound Members   File Members  

sort.c File Reference

#include "syscall.h"

Go to the source code of this file.

Functions

int main ()

Variables

int A [1024]


Function Documentation

int main  
 

Definition at line 15 of file sort.c.

References A, Exit, and j.

00016 {
00017     int i, j, tmp;
00018 
00019     /* first initialize the array, in reverse sorted order */
00020     for (i = 0; i < 1024; i++)          
00021         A[i] = 1024 - i;
00022 
00023     /* then sort! */
00024     for (i = 0; i < 1023; i++)
00025         for (j = i; j < (1023 - i); j++)
00026            if (A[j] > A[j + 1]) {       /* out of order -> need to swap ! */
00027               tmp = A[j];
00028               A[j] = A[j + 1];
00029               A[j + 1] = tmp;
00030            }
00031     Exit(A[0]);         /* and then we're done -- should be 0! */
00032 }


Variable Documentation

int A[1024]
 

Definition at line 12 of file sort.c.

Referenced by main.


Generated on Mon Feb 10 09:54:51 2003 for nachos by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002
The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees