Assignment 5

Write a function num2str that converts a 32 bit integer into a null-terminated ascii string of characters.

void num2str(int num, char str[]);

Inside your function you may assume that there is sufficient space allocated in the output argument string to store all the characters of num.

Then write the main program, which calls the num2str function and displays the generated string in the console window. You may use syscall 4 to display the string, as described in the textbook pages A-43 to A-45. You’ll want to make sure that the pointer you pass to your function points to a sufficiently large area to contain the resulting string. 9 or 10 bytes should be plenty.

Your program must run in SPIM without error.

This assignment is the second part of a three-assignment series.

last edited 2005-10-04 13:10:23 by GaryBishop