diff options
Diffstat (limited to 'src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexs.c')
-rw-r--r-- | src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexs.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexs.c b/src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexs.c new file mode 100644 index 0000000..1e942e6 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2hex/u16dec2hexs.c @@ -0,0 +1,38 @@ +#include <string.h> +#include <math.h> +#include "dec2hex.h" +#include <stdio.h> + +void u16dec2hexs(uint16 in,char* out) +{ + int quot; + int i=0,j=0,k=0,tmp,temp; + quot=(int)in; + while(quot!=0) + { + temp=quot%16; + //To convert integer into character + if(temp < 10) + temp = temp + 48; + else + temp = temp + 55; + + out[i++]=temp; + quot = quot/16; + //printf("%c ",out[i-1]); + } + out[i]='\0'; + j=i-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } + out[i+1]=' '; + +} |