how to assign value to some non-array parameters in a FOR loop

Hello,

First of all, I'm new to programming C++.

I'm not sure how to ask my question. Suppose we have the following parameters with a constant pattern:

RemoteXY.edit_D_L_1;
RemoteXY.edit_D_L_2;
RemoteXY.edit_D_L_3;
RemoteXY.edit_D_L_4;
.
.
RemoteXY.edit_D_L_n;

For some reason I cannot change them to array.

Is there any way I can assign value to them in a FOR loop?

Is there any way I can assign value to them in a FOR loop?

No. Variable names are meaningless and not available after compilation so you can't just concatenate a number with a variable name and create a new variable if that is what you had in mind

For some reason I cannot change them to array.

Cannot or do not know how to ?

Yes.

First, if (and only if) they are consecutive in the RemoteXY struct, you CAN make them an array

struct
{
  ..
  ..
  type edit_D_L_1;
  type edit_D_L_2;
  type edit_D_L_3;
  type edit_D_L_4;
  ..
  ..
} RemoteXY;

Is the same as:

struct
{
  ..
  ..
  type edit_D_L[4];
  ..
  ..
} RemoteXY;

If they are not consecutive, then you can make an array of pointers to those struct variables:

struct
{
  ..
  ..
  type edit_D_L_1;
  ..
  ..
  type edit_D_L_2;
  ..
  ..
  type edit_D_L_3;
  ..
  ..
  type edit_D_L_4;
  ..
  ..
} RemoteXY;

type * const arrayOfVariables[] =
{
  &RemoteXY.edit_D_L_1,
  &RemoteXY.edit_D_L_2,
  &RemoteXY.edit_D_L_3,
  &RemoteXY.edit_D_L_4,
}

Example here: 9MCQ6a - Online C++ Compiler & Debugging Tool - Ideone.com

if the value of constants is related to the symbol name I would use a script to generate the code

constant int D_L_00 =  0;
constant int D_L_01 =  1;
constant int D_L_02 =  2;
constant int D_L_03 =  3;
constant int D_L_04 =  4;
constant int D_L_05 =  5;
constant int D_L_06 =  6;
constant int D_L_07 =  7;
constant int D_L_08 =  8;
constant int D_L_09 =  9;
constant int D_L_10 = 10;
# temperature sensor

awk '
BEGIN {
    for (n = 0; n < 11; n++)
        printf "constant int D_L_%02d = %2d;\n", n, n
}'

symbol names (e.g. D_L_4) are unknown during execution. variables are replaced with addresses and constant with their values