I have some if statements to handle the value_type in different ways. If INT is defined then value_type is an integer, but if CHAR is defined value_type is a string. How can I handle this so I don' get any errors or warnings ?
I defined value_type like this:
#ifdef INT
typedef int value_type;
#define TYPEMODE 1
#endif
#ifdef CHAR
typedef char value_type[80];
#define TYPEMODE -1
#endif
I handled it like this in functions:
int functionName(value_type val) {
if (TYPEMODE == 1) {
val = 5;
}
if (TYPEMODE == -1) {
strcpy(val, "hi");
}
return 0;
}
If I define INT it gives me a warning for strcpy, if I define CHAR it gives me a warning for val = 5.
Is there a better way to handle this that won't give me any warnings with gcc -Wall file.c -o file?