I like the luxury. I wanted to invent a way for you to obtain the number of digits the unsigned long long int
maximum possess. All that automatically.
Here it is:
#include <limits.h>
#include <string.h>
#define STRINGIFY(x) #x
#define ULLONG_MAX_STRING STRINGIFY(ULLONG_MAX)
#define NUMERAL_MAXIMUM strlen(ULLONG_MAX_STRING)
Does this work as described?
Now about the strange behavior that pretty much answers the question from above.
If I declare a variable like so (-std=c99
specific):
char variable [NUMERAL_MAXIMUM];
instead of declaring automatic-scoped variable, array with the size of 20, it terminates the program before it even reaches that line. Though if I don´t declare the variable like so, nothing terminates and the program continues to work.
What is going on?
Update: Even more strange is that the program does that only if I use this obtained length as a size of an array.