Skip to content

Commit f279584

Browse files
committed
fix incorrect variable bug in sum printout
1 parent 2c318ce commit f279584

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ch05_01_timers/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Repository: https://github.com/capnramses/pro_programming_tools_c_cpp
2121
uint64_t frequency = 1000000, offset;
2222

2323
// initialise timer variables for build's platform
24-
void init_timer() {
24+
void init_timer( void ) {
2525
#ifdef _WIN32
2626
{
2727
uint64_t counter;
@@ -34,7 +34,7 @@ void init_timer() {
3434
mach_timebase_info_data_t info;
3535
mach_timebase_info( &info );
3636
frequency = ( info.denom * 1e9 ) / info.numer;
37-
offset = mach_absolute_time();
37+
offset = mach_absolute_time();
3838
}
3939
#else
4040
{
@@ -47,7 +47,7 @@ void init_timer() {
4747
}
4848

4949
// get the current time in seconds with up to nanosecond precision
50-
double get_seconds() {
50+
double get_seconds( void ) {
5151
#ifdef _WIN32
5252
{
5353
uint64_t counter = 0;
@@ -78,7 +78,7 @@ int main( void ) {
7878
int sum = 0;
7979
for ( int i = 0; i < 10000; i++ ) {
8080
sum++;
81-
printf( "sum = %i\n", i );
81+
printf( "sum = %i\n", sum );
8282
}
8383

8484
double end_s = get_seconds();

0 commit comments

Comments
 (0)