Hello,
My problem is that I want to merge 2 arrays to 1 array but I have errors when I build the program.
void can_merge_16_32(u16_t part_a, u16_t part_b) { u32_t output = 0; u16_t i = 0; for( i = 0 ; i < 16 ; i++) { output[i] = part_a[i]; output[i+16] = part_b[i]; } return output; }
src\\can.c(187): error: subscripted value is neither array nor pointer
your function returns void, and your want to return an uint32_t. That's basic C programing.
What makes you think that?
"What makes you think that?"
Well, the posted code does at least attempt to return a u32_t variable.
void can_merge_16_32(u16_t part_a, u16_t part_b) { u32_t output = 0; ... return output; }
The program attempts a number of things which seem at odds with the OP's stated aim...
But it doesn't seem that the OP is really interested anyhow.
I know now that I do not need an array. I've solved my problem : u32_t LatDegMin = 0; u16_t LatDegMin_local = pi.pos.latMin; LatDegMin = (LatDegMin_local<<16) | pi.pos.latDeg;
sorry for my bad english
Your new code don't seen to relate in any way to your original post.
Another thing - your new code makes use of 16-bit and 32-but unsigned integers. But at the same time, you claim that one variable named "DegMin" needs a 32-bit unsigned while another "DegMin" can manage with just a 16-bit unsigned. That indicates that your data types or variable names aren't well selected.
Besides that - it also looks like you might possibly multiply arc minutes with 65536 (shift 16 steps left) before combinining with degrees. But arc minutes would be a smaller unit than degrees - but a larger unit than arc seconds.
LatDegMin = (LatDegMin_local<<16) | pi.pos.latDeg;
If a shift's right operand is greater than or equal the width of the left operand, the behavior is undefined.