Jordan Abel said:
So is the string he has with the hex digits - there's very little
you can do without literal values of any kind - i think the most
complicated program you can implement is echo.
Aha, a challenge!
Without using literals, you can easily construct constant expressions
for any integer you like:
static int dummy;
#define ZERO (&dummy!=&dummy)
#define ONE (&dummy==&dummy)
#define TWO (ONE+ONE)
#define THREE (TWO+ONE)
#define FOUR (THREE+ONE)
Character and string literals are a bit more difficult. You can
construct anything you like if you're willing to assume an ASCII
encoding, but that's cheating. I think you can determine the values
of '0' through '9' by looping over the range 0 .. SCHAR_MAX and
checking isdigit(). You can do the same thing for letters by checking
isupper() and islower(); this works for both ASCII and EBCDIC, but not
for any character sets in which the letters aren't in alphabetical
order. (The results won't be constant expressions unless you go to a
*lot* of extra effort.)
fopen() is difficult because the mode argument is usually a string
literal. It doesn't have to be a constant, but I can't think of a
good way to generate an 'r' or 'w' character.
printf(), of course, requires a format string. It can be built up
manually if you can construct the required characters.
Just to be clear (and because I've criticized others for not including
this disclaimer), this is absolutely nothing more than a silly little
intellectual exercise, of no actual use that I can think of. And I
haven't had a homework assignment in decades.