In my code I have a lot of vectors with a similar name:
vector1, vector2, vector3, vector4, ...
Because I don't want to write the same code with the only difference of the names of vectors I tried creating this macro:
#define VECTOR(x) vector##x
I tried this code as an example:
int n = 1;
printf("%d", VECTOR(n)[0]);
I thought that was the same as printf("%d", vector1[0]); but the compiler substitutes the macro VECTOR(n)[0] with vectorn[0]
Can you give me a solution to this problem or suggest me other tecniques to use? Thanks
In my code I have a lot of vectors with a similar name:
vector1, vector2, vector3, vector4, ...
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,089 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 152:53:33 |
| Calls: | 13,921 |
| Calls today: | 2 |
| Files: | 187,021 |
| D/L today: |
3,630 files (919M bytes) |
| Messages: | 2,457,123 |