1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
// This is from office hours 1/23/2020.
//
// OK to copy/adapt code from this file
//
// How to use helper functions in hw02.c.
// - Method 1:  Declare it above the function(s) that call it.

#include <stdio.h>
#include <stdlib.h>
#include "hw02.h"

void _print_digit(int digit_value) { // CQ: Helper function name must start with "_"
    fputc('0' + digit_value, stdout);
}
// Code quality:  Helper functions must have a name starting with "_".
//                Ex:  _print_digit(…), not print_integer(…)

void print_integer(int n, int radix, char* prefix) {
    _print_digit(n);
    // This is a very simple implementation that will pass some
    // easy test cases.  You will need to add more code, obviously.
}

© Copyright 2020 Alexander J. Quinn         This content is protected and may not be shared, uploaded, or distributed.