Array to store values - Do I need to manual update

Neither of your examples will work as written the way you are expecting them to. To do what you are trying to accomplish:

int a = 3;
int b = 1;
int array[] = {a, b};

void loop()
{
   array[1] = 6;
}

In other words, you have defined your array with two integer values of "3" and "1" in it (you could have written it also as "int array[] = {3, 1};") - these occupy slots 0 and 1 of the array (array counting begins at 0) - so, you have defined an array with two integers (the length of the array is "2"), positions 0 and 1 in the array.

In the code above, we change position 1 of the array, from the value "1" it was initialized as, to the value "6".

Also note that in your code, it would be better to define the values as integer constants rather than integer variables (unless you have a specific reason to do so), because the constants don't take up valuable RAM space (the pre-processor subs the values in where needed), whereas the variable declarations do:

#define VALUE_A 3
#define VALUE_B 1

int array[] = {VALUE_A, VALUE_B};

void loop()
{
   array[1] = 6;
}

Two other things:

  1. Define your arrays for the size of data going into them - RAM is precious on microcontrollers, so if you only need the space for byte-sized values, declare as byte (vs 2 bytes needed for an integer value per array element, etc).

  2. Name your variables properly - don't use "a", "b", "array" - give them names that mean something (also remember to use and stick with a type of casing approach - I typically use all upper-case for my #define constants, this kind of "CamelCasing" for my variables, and this kind of "camelCasing()" for my function defines. Trust me - it will make things MUCH easier to read and understand; even if you are the only coder on the project, you WILL come back to the code at a later date, and if you don't have much documentation (comments are your friends), you will be left scratching your head.

I have been doing software development for over 25 years in one form or another; this is experience speaking to you: please heed it, or ignore it at your peril.

Good luck, and I hope this post made things clearer.