Hope someone can help me here. Fairly new to C (come from a PHP background) and been stuck on this problem couple days now. Still trying to get head round pointers etc, a joy PHP doesn't have.
So basiclly, I want to be able to update a specific value within the array to a value given via the UART. The UART is all working correctly. Just cant get the code to work to update the array. Data from the UART, will be in the string 'uart' in the code below and will have the value '0430' (First 2 digits refer to the array key and the 2nd two will be the value to update it to).
// Array values
int unsigned array[15] = {05,76,33,02,11,07,34,32,65,04,09,32,90,03,44};
// Split the UART string into required parts
// Array Key
int key;
memcpy (key, &uart[0], 2);
// New Value
int value;
memcpy (value, &uart[2], 2);
array[key] = value; // Im sure this is wrong and needs to be done via a pointer?
The new array should now be: {05,76,33,02,30,07,34,32,65,04,09,32,90,03,44};
Any advice would be great and even a short explaination would be superb to help me understand.
Thanks in advance