My issue: I want to get an id with N_DIGITS digits and I would like N_DIGITS to be customizable at preprocessing. My id is an integer so I want to define 10^N_DIGITS as the maximum of this number.
In other words: is it possible to preprocess a number with a macro as exponent?
Here is my ultimate attempt:
#include <stdio.h>
#define N_DIGITS 5
#define MAX_N 10e ## N_DIGITS
int main()
{
printf("%d\n", MAX_N);
return 0;
}
Of course, this doesn't work and the error is error: exponent has no digits.
I don't see why the principle could not be implemented since everything is known by the compiler but I might be wrong.
Anyway my syntax is incorrect, can I get some help here?