close

以下:

8進制轉10進制

16進制轉10進制

 

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
/* octal(8) to Decimal(10) */
char i[32] = "11";
printf("%lu\n", strtol(i,NULL,8)); // result is 9

/* Hex(16) to Decimal(10) */
char j[32] = "A2";
printf("%lu\n", strtol(j,NULL,16)); // result is 162
return 0;
}

 
arrow
arrow
    全站熱搜

    = = 發表在 痞客邦 留言(0) 人氣()