Chris McDonald wrote:
> Richard Heathfield <rjh@see.sig.invalid> writes:
>
>> Jason20005 said:
>
>>> Dear all,
>>>
>>> Why C and some of other languages dont allow the name of a variable
>>> start with a digit?
>
>> Assume C *did* allow it. What should the output of this program be?
>
>> #include <stdio.h>
>
>> int main(void)
>> {
>> int 42 = 6;
>> printf("%d\n", 42);
>> return 0;
>> }
>
>> What should be printed, and why?
>
>
> The question was actually about *starting* with a digit,
> which doesn't necessarily imply consisting *only* of digits.
>
> But what about: long int 42L = 6;
Try a few small adjustments to Richard's example:
#include <stdio.h>
int main(void) {
int 0x42 = 6;
double 42e0 = 6;
double 42e = 6;
printf ("%d %g %g\n", 0x42, 42e0, 42e-1);
return 0;
}
Now what?
--
Eric Sosman
esosman@ieee-dot-org.invalid