Im a fairly new c programmer. Ive done abit of programming but not much. Any comments or solutions are needed please.
Im wanting to create a file that converts between the character string representation of a number and its machine representation.
Im wanting to use three functions to do this... adding greater functionality to the file. First of all I think I could use the itoa() function to do the conversion.
char *itoa(int n);
this would convert n into its character string representation in the current number base (between 2 and 36) and would return the address of the string.
The first funtion I want to have in the file would be:
void setbase(int n);
This function sets the number base. If 1<b and b<37 then the number base would be set. A error would be invoked if the number base is not in the range.
I would want this function to return the current valeu of the i/o number base.
int convert(char string);
providing the number base is set between 2 and 36, this function would need to convert the described string in the current base to its machine representation. If the number base is not recognised and not in the range... a error would need to be reported and would return any value.