Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Macro/preprocessor handling (http://www.go4expert.com/forums/macro-preprocessor-handling-t211/)

arangasoft 27Nov2004 18:14

Macro/preprocessor handling
 
Hai everybody

i have one question. ie how to define the macro/preprocessor which replace to code whatever string input is given.

for example
if the program like this
Code:

#include<stdio.h>
#define MACRO(_)  (____________________)
main()
{
char a[3][]={
                      "int a,b;",
                      "a=10;b=20;",
                      "printf("a=%d,b=%d",a,b);"
                  };
MACRO(s[0])
MACRO(s[1])
MACRO(s[2])
}

the output will be.....
a=10,b=20

If anyone know the answer please tell me soon.

shabbir 28Nov2004 07:32

Re: Macro/preprocessor handling
 
I dont think anything like that is possible but would like to be proved wrong by some other C/C++ guys.

elec.shabnam 26Feb2008 17:10

Re: Macro/preprocessor handling
 
sir macros receive values in compile time,so in run time we cannot change,is it right.


All times are GMT +5.5. The time now is 22:51.