title: Converting number into different notations
body: <p>This is the program to convert a number into different representations like octal,decimal,hexadecimal etc.</p>
  
  <pre><code>    #include&lt;stdio.h&gt;
  
      char *convert(unsigned int num, int base)
      {
      static char buff[33];
      char *ptr;
      ptr=&amp;buff[sizeof(buff)-1];
      *ptr='\0';
      do
      {
      *--ptr="0123456789abcdef"[num%base];
      num/=base;
      }while(num!=0);
      return(ptr);
      }
  
      int main(){
  
      puts(convert(65,8));
      puts(convert(65,10));
      puts(convert(65,16));
      return 0;
      }
  </code></pre>
  
  <p>Output gives 101 ,65 and 41 ( i.e the number '65' represented in octal,decimal and hexadecimal notations respectively)</p>
  
  <p>I pretty much understand whats going on but i have never come across anything like</p>
  
  <pre><code>*--ptr="0123456789abcdef"[num%base]
  </code></pre>
  
  <p>I understand its working but i dont understand how it is a valid notation. Someone please explain the 0123456789abcdef(literal character array) part here.</p>