Hello,
I was able to store variables' names in an array. So I have couple questions about it:
1. I want to know what is the application of storing variables' names in an array and call them for any specific program or a function?
2. Is there a way to develop variables' names automatically? I think Microsoft Excel is one example and also writing the names with FILE functions to a .txt file, are there other ways which can be done inside the C file?
Here's my example code, it works:
Code:
#include <stdio.h>#include <stdlib.h>
#include <inttypes.h>
void read_var (void)
{
uint8_t i;
uint8_t n0 = 11,n1 = 100,n2 = 22,n3 = 33,
n4 = 4,n5 = 5,n6 = 6,n7 = 7,n8 = 8,
n9 = 79,a = 170,b = 144,c = 121,d = 13,
e = 14,f = 15;
uint8_t hex_array[16]={n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,a,b,c,d,e,f};
for (i=0;i<16;i++)
{
printf("%d\n",hex_array[i]);
}
}
int main(void) {
read_var();
return 0;
}