is there any structure that can store a value (char, int, float...) and a string that is associated with that value and then whenever the string occurs in prog it is replaced with the value?
it must be too good to be true...
is there any structure that can store a value (char, int, float...) and a string that is associated with that value and then whenever the string occurs in prog it is replaced with the value?
it must be too good to be true...
I've never felt the nausea of longing to feel nothing,
I never wanted to cease to exist, just disappear...
Are you familiar with how #define works?
If so, you'll have to clarify your question...
gg
i know how it works... what i wanted to do was to make a different kind of define... the thing is, i am making a customized preprocessor just for the purpose of learning how to program in C cause i'm a real n00b... i already made my very own #include and now i'm trying to make my #define...
I've never felt the nausea of longing to feel nothing,
I never wanted to cease to exist, just disappear...
So you're making a pre-preprocessor....those are fun.
If you're making your own #define, then you should be able to just do straight word replacement. There's no need to know if it's a char, int, float, or whatever.
So here's a more defined problem statement:
Find a all occurences of word A, and replace it with word B, where a word is defined as any valid C-language identifier.
A valid C identifier is a contiguous series of only the following characters: 'A'-'Z', 'a'-'z', '0'-'9', and '_'.
gg
Not to throw cold water on your desire, but if you are such a n00b why are you trying to make a program that is beyond the scope of a noob? Why not learn to program not by trying to write a program even knowledgable programmers won't do but by programs that allow you to learn the code without having to ask how to do each step and learn such advanced techniques? Maybe you should save the advanced techniques for later when you have the concept of C syntax and coding figured out.Originally Posted by incognito54
Definition: Politics -- Latin, from
poly meaning many and
tics meaning blood sucking parasites
-- Tom Smothers
Besides there is nothing fancy or advanced to misusing the C pre-processor. It will only teach you bad habits.
the structure of multi types exists in the c and the c++.
you can declare it of the following way
struct / *nameofstruct * /
{
declaration types
}
/ * end; * /
again you can a type of struct
typedef struct
{
declaration variables
}
/ *name of type * /