CS318 - Pintos
Pintos source browser for JHU CS318 course
Main Page
Data Structures
Data Structures
Data Structure Index
Data Fields
All
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
w
x
y
Typedefs
b
e
f
h
i
l
m
o
p
s
t
u
v
Enumerations
Enumerator
b
c
g
i
p
q
r
s
t
u
Macros
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
src
examples
bubsort.c
Go to the documentation of this file.
1
/** sort.c
2
3
Test program to sort a large number of integers.
4
5
Intention is to stress virtual memory system.
6
7
Ideally, we could read the unsorted array off of the file
8
system, and store the result back to the file system! */
9
#include <stdio.h>
10
11
/** Size of array to sort. */
12
#define SORT_SIZE 128
13
14
int
15
main
(
void
)
16
{
17
/* Array to sort. Static to reduce stack usage. */
18
static
int
array[
SORT_SIZE
];
19
20
int
i, j, tmp;
21
22
/* First initialize the array in descending order. */
23
for
(i = 0; i <
SORT_SIZE
; i++)
24
array[i] =
SORT_SIZE
- i - 1;
25
26
/* Then sort in ascending order. */
27
for
(i = 0; i <
SORT_SIZE
- 1; i++)
28
for
(j = 0; j <
SORT_SIZE
- 1 - i; j++)
29
if
(array[j] > array[j + 1])
30
{
31
tmp = array[j];
32
array[j] = array[j + 1];
33
array[j + 1] = tmp;
34
}
35
36
printf
(
"sort exiting with code %d\n"
, array[0]);
37
return
array[0];
38
}
main
int main(void)
Definition:
bubsort.c:15
printf
int printf(const char *format,...)
Writes formatted output to the console.
Definition:
stdio.c:79
SORT_SIZE
#define SORT_SIZE
sort.c
Definition:
bubsort.c:12
Generated on Thu Aug 22 2019 10:19:15 for CS318 - Pintos by
1.8.16