value of TRUE???
Farrell Woods
ftw at masscomp.UUCP
Wed Mar 8 06:11:14 AEST 1989
In article <987 at infmx.UUCP> kevinf at infmx.UUCP (Kevin Franden) writes:
>given: :The if() statement will evaluate to true provided that
> the argument does not evaluate to 0. (ie a=3; if (a)...)
Expressions have values in C. Since there is no boolean type in C,
expressions that evaluate to non-zero values are taken as "true",
and zero-valued as "false".
>What does if (a=3) evaluate to?
The expression "a = 3" has the value of 3, which is non-zero and therefore
"true". Therefore:
if (a = 3)
printf("true!\n");
will always execute the printf().
--
Farrell T. Woods Voice: (508) 392-2471
Concurrent Computer Corporation Domain: ftw at masscomp.com
1 Technology Way uucp: {backbones}!masscomp!ftw
Westford, MA 01886 OS/2: Half an operating system
More information about the Comp.lang.c
mailing list