C program to get variable name as input and print value

前端 未结 4 1019
一整个雨季
一整个雨季 2021-01-16 16:58

I have a program test.c

int global_var=10;
printf(\"Done\");

i did

gcc -g test.c -o test

My query is I

4条回答
  •  醉话见心
    2021-01-16 17:32

    No. We only have variable names so humans don't get confused . After your program gets turned into assembly and eventually machine code, the computer doesn't care what you name your variables.

    Alternatively you could use a structure in which you would store the value and the name as a string:

    struct tag_name {
       char *member1;
       int member2;
    };
    

提交回复
热议问题