How to convert byte array (containing hex values) to decimal

前端 未结 5 917
时光说笑
时光说笑 2021-01-29 08:02

I am writing some code for an Atmel micro-controller. I am getting some data via Uart, and I store these hex values into an array.

Suppose the elements of the array are:

5条回答
  •  一个人的身影
    2021-01-29 08:40

    #include 
    
    int main(){
        char data[] = {0x1F, 0x29, 0x3C};
        int i, size = sizeof(data);
        unsigned value = 0;
    
        for(i=0;i

提交回复
热议问题