I am trying to concatenate a uint8_t array into a uint32_t through a standard concatenation technique using the arithmetic operations. Here's my code:
#include <stdint.h>
void setup() {
Serial.begin(9600);
bs();
}
void bs(){
uint8_t arr1[] = {23, 56, 78, 50};
uint32_t arr2;
arr2 = (1000000*arr1[0]) + (10000*arr1[1]) + (100*arr1[2]) + (arr1[3]) ;
Serial.print(arr1[3]);
}
void loop() {}
The output is: 22978026
The output should be pretty obvious. But still I ran the same code on another platform and it worked as expected and gave me 23567850. Am I missing something here? Could I give more info to help find the problem here?