C (programming language)/Tutorials: Difference between revisions
Jump to navigation
Jump to search
imported>Eric Evers (New page: =C Programming Language Tutorials= ==Truth values and Iverson Bracket== The C programming language is set up nicely to support the Iverson Bracket set notation. Iverson proposed that tr...) |
(No difference)
|
Revision as of 21:12, 22 April 2008
C Programming Language Tutorials
Truth values and Iverson Bracket
The C programming language is set up nicely to support the Iverson Bracket set notation. Iverson proposed that truth values are numerical with true=1 and false=0. Actually 0=false in C and all non-zero values are True, even -1.
The following calculates the maximum of two numbers using an Iverson bracket formula using the notation in C.
max = (a>=b)*a + (b<a)*b;
============================= lets caluculate using 6 and 7
7 = (6>=7)*6 + (7<6)*7