Skip to content

Latest commit

 

History

History

convert-a-number-to-a-string

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
  • Completed at: 2023-09-22T17:27:59.134Z

  • Completed languages: java

  • Tags: Strings, Fundamentals

  • Rank: 8 kyu

Description

We need a function that can transform a number (integer) into a string.

What ways of achieving this do you know?

In C, return a dynamically allocated string that will be freed by the test suite.

Examples (input --> output):

123  --> "123"
999  --> "999"
-100 --> "-100"
RISC-V: The function signature is:

```c
void number_to_string(int n, char *out);
```

Convert the input number `n` to a string, and write the result to `out`. You may assume `out` is large enough to hold the result. You do not need to return anything.