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
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