repo.or.cz
/
sdcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git]
/
sdcc
/
support
/
regression
/
tcc
/
110_average.c
blob
273b5110736366173024c68f5fe7ea277091c859
1
#include <stdio.h>
2
3
typedef
struct
4
{
5
double
average
;
6
int
count
;
7
}
8
stats_type
;
9
10
static void
11
testc
(
stats_type
*
s
,
long long
data
)
12
{
13
s
->
average
= (
s
->
average
*
s
->
count
+
data
) / (
s
->
count
+
1
);
14
s
->
count
++;
15
}
16
17
int
main
(
void
)
18
{
19
stats_type s
;
20
21
s
.
average
=
0
;
22
s
.
count
=
0
;
23
testc
(&
s
,
10
);
24
testc
(&
s
,
20
);
25
printf
(
"%g %d
\n
"
,
s
.
average
,
s
.
count
);
26
return
0
;
27
}