To solve this problem PROPERLY, you probably need to store some information as to what the actual type is that you are storing.

Also, if you want to store strings, it is MUCH simpler if you have storage for the string itself in the struct, e.g.
Code:
struct something
{
    char str[10];
    int    x;
};

Code:
    setProperty("def", "20") ;
def is an integer. "20" is a string - it just happens to contain digits.

Code:
    printf("MAIN TEST4, def=%d\n", (int*)getProperty("def")) ;
For this to be even remotely correct, you should probably print *(int*)getProperty("def") - however, that is still quite wrong, since you didn't actually store an integer at this address.

And since def in the original struct is a int *, if you actually MEAN for it to be an int *, you need to allocate memory for the integer to be stored there, and then store the integer value into the new location. That is not a good plan because it's overly complex (more code, and more memory used) compared to the trivial solution of storing an integer directly. So declare def as "int", not "int *", and you would be OK.

Of course, with that fix, you have to find a way to pass an integer instead of a string into the set property - here is where it gets tricky at this point. One idea would be to pass the ADDRESS of an integer, but that means you can't use a constant value, OR a calculation. And you obviously need some way to track how the value is supposed to be stored in the structure.

One possible solution would be to have a set of functions:
setPropertyInt(...)
setPropertyString(...)
setPropertyDouble(...)
and so on. And of course the same principle for the getProperty.

Another idea would be to pass in a (pointer to) union that contains the actual data to be stored. Again, it means you can't have formulas in there, but it makes it ONE function.

--
Mats