[LCP]Printing a Variables Value..!!!

J.Mohamed Zahoor zahoor at midascomm.com
Fri Jun 20 18:06:01 UTC 2003


Hi all..

I have a doubt in C.. or rather we r trying to find a
way for this problem from long back...

problem: 

   Assume there a 3 variables in a program named aaa,bbb & ccc.
   Assume that all are integers with values 10,20 & 30 resp.
   Can any one write a program which gets as input the name of
   any of these variable and prints the value of it.

  like 

main()
{
   int aaa =10, bbb =20, ccc =30;
   char varName[20];
   
   memset(varName,0,20);
   printf ("Enter any variable name\n");
   gets(varName);  /* Assume i entered aaa */

   Do something here to print the value of aaa
}

-- 
Thanx & Regards
J.Mohamed Zahoor

Let's tame this little penguin...!!!





More information about the linuxCprogramming mailing list