FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
randomgraph/array.c at main · Hermann-SW/randomgraph · GitHub
Hermann-SW
/
randomgraph
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
randomgraph
/
array.c
Copy path
More file actions
More file actions
Latest commit
History
History
History
90 lines (77 loc) · 2.1 KB
Breadcrumbs
randomgraph
/
array.c
Copy path
File metadata and controls
90 lines (77 loc) · 2.1 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
* File: array.c
* - implementation of array datatype
*
* Author: Hermann Stamm-Wilbrandt
* Institut fuer Informatik III
* Roemerstr. 164
* Bonn University
* D-53117 Bonn
* Germany
* email: hermann@holmium.informatik.uni-bonn.de
* phone: 0228-550-260 internal: x260 or x28, Fax: 0228-550-382
*
* For my safety:
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#include
"array.h"
/*----------------------------------------------------------------------------*/
num
*
new_array
(
num
k
)
{
num
*
p
=
(
num
*
)
MALLOC
(
k
*
sizeof
(
num
));
if
(
p
==
NULL
)
err_handler
(
1
,
"out of memory during array allocation"
);
p
[
0
]
=
0
;
return
p
;
}
void
delete_array
(
num
*
A
) {
FREE
(
A
); }
void
init_array
(
num
low
,
num
high
,
num
x
,
num
*
A
)
{
num
i
;
for
(
i
=
low
;
i
<=
high
;
i
++
)
A
[
i
]
=
x
; }
double
*
new_array_of_double
(
num
k
)
{
double
*
p
=
(
double
*
)
MALLOC
(
k
*
sizeof
(
double
));
if
(
p
==
NULL
)
err_handler
(
1
,
"out of memory during array allocation"
);
p
[
0
]
=
0
;
return
p
;
}
void
delete_array_of_double
(
double
*
A
) {
FREE
(
A
); }
void
print_array
(
num
low
,
num
high
,
num
*
A
)
{
num
i
;
for
(
i
=
low
;
i
<=
high
;
i
++
)
printf
(
"+---"
);
printf
(
"+\n"
);
for
(
i
=
low
;
i
<=
high
;
i
++
)
printf
(
"|%3d"
,
i
);
printf
(
"|\n"
);
for
(
i
=
low
;
i
<=
high
;
i
++
)
printf
(
"+---"
);
printf
(
"+\n"
);
for
(
i
=
low
;
i
<=
high
;
i
++
)
printf
(
"|%3d"
,
A
[
i
]);
printf
(
"|\n"
);
for
(
i
=
low
;
i
<=
high
;
i
++
)
printf
(
"+---"
);
printf
(
"+\n"
);
}
void
print_array_of_double
(
num
low
,
num
high
,
double
*
A
)
{
num
i
;
for
(
i
=
low
;
i
<=
high
;
i
++
)
printf
(
"+------"
);
printf
(
"+\n"
);
for
(
i
=
low
;
i
<=
high
;
i
++
)
printf
(
"|%6d"
,
i
);
printf
(
"|\n"
);
for
(
i
=
low
;
i
<=
high
;
i
++
)
printf
(
"+------"
);
printf
(
"+\n"
);
for
(
i
=
low
;
i
<=
high
;
i
++
)
printf
(
"|%6.2f"
,
A
[
i
]);
printf
(
"|\n"
);
for
(
i
=
low
;
i
<=
high
;
i
++
)
printf
(
"+------"
);
printf
(
"+\n"
);
}
void
USE2
()
{
(
void
)
new_array
(
0
);
delete_array
(
0
);
(
void
)
new_array_of_double
(
0
);
delete_array_of_double
(
0
);
USE2
();
}
Back
|
FazBrowse Home
|
New Git URL