十进制数与八进制数互相转换(MATLAB和C版本)

一、八进制数转十进制数

C语言实现

实现思路和参数:

/* Function: ConvertOctaltoDecimal
 * Abstract: Convert an octal number to its equivalent decimal value
 *
 *    - First compute the number of digits in the octal number
 *    - Then perform the conversion, one digit at a time, starting
 *      with the least significant digit
 *
 *          work1: The remaining digits in the octal value
 *          work2: Equal to work1 with the least significant digit set to zero
 *          work3: Accumulator to compute decimal value
 *          work4: Octal place value - 1, 8, 64, ...
 */
int ConvertOctaltoDecimal(int OctalValue)
{
   
    int

你可能感兴趣的:(VC算法与小工具实现,matlab,c语言,十进制,八进制,转换)