Functions | Variables
testPrint.c File Reference

Driver to test functions of printnum.c (do not modify) More...

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

Functions

static void usage ()
 
static int getArg (char *arg)
 
int main (int argc, char *argv[])
 

Variables

char * digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 

Detailed Description

This is a driver program to test the functions defined in printnum.h and implemented in printnum.c.

Function Documentation

◆ getArg()

static int getArg ( char *  arg)
static

Get int value from argument, allowing binary input like 0b0111001

Parameters
argstring containing value (decimal, octal, hex, binary)
Returns
value

◆ main()

int main ( int  argc,
char *  argv[] 
)

Entry point of the program

Parameters
argccount of arguments, will always be at least 1
argvarray of parameters to program argv[0] is the name of the program, so additional parameters will begin at index 1.
Returns
0 the Linux convention for success.

◆ usage()

static void usage ( )
static

Print a usage statement, then exit the program returning a non-zero value, the Linux convention indicating an error

Variable Documentation

◆ digits

char* digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"

A string of characters representing the digits to output for a particular value. Defined in the file testPrint.c.