title: How to convert unsigned short to string in C?
body: <p>I am not familiar to C programming and used to casting some variables to string by <code>ToString()</code> in C#.</p>
  <p>But now I need to write a similar function in C for some embedded Linux system.</p>
  <p>What is the most general way to do that?</p>
  <p>For example：</p>
  <pre><code>unsigned short a = 1234;
  char* a_string = malloc(5);
  
  char* ToString(unsigned short v)
  {
      char* str
      ...
      ...
      return str;
  }
  
  int main()
  {
      a_string = ToString(a);
  }
  // result : a_string[0] = '1',  a_string[1] = '2', a_string[2] = '3', a_string[3] = '4', a_string[4] = '\0'
  </code></pre>
  <p>I would appreciate some hint or direction.</p>