Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
prob w/the C prog. lang. book(ANSI C)
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Irrwahn Grausewitz, post: 1706764"] Before calling other people idiots you certainly want to point out the differences (modulo comments and whitespace) between the following two programs, the first of which was cut'n'pasted from OP's message, the second one being an exact copy of the _first_ example in section 1.2 of K&R2: ---8<-------OP------------------------------------------------- #include <stdio.h> main() { int fahr, celsius; int lower, upper, step; lower = 0; upper = 300; step = 20; fahr = lower; while (fahr <= upper) { celsius = 5 * (fahr-32) / 9; printf("%d\t%d\n", fahr, celsius); fahr = fahr + step; } } ---8<-------K&R2----------------------------------------------- #include <stdio.h> /* print Fahrenheit-Celsius table for fahr = 0, 20, ..., 300 */ main() { int fahr, celsius; int lower, upper, step; lower = 0; /* lower limit of temperature scale */ upper = 300; /* upper limit */ step = 20; /* step size */ fahr = lower; while (fahr <= upper) { celsius = 5 * (fahr-32) / 9; printf("%d\t%d\n", fahr, celsius); fahr = fahr + step; } } ---8<-------------------------------------------------------- Please report back if you find any substantial differences. HTH Regards PS: I no longer own a working copy of K&R1 to cross-check, but as the OP claimed he just bought the book, it's _extremely_ unlikely he's holding anything else but a copy the second edition. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
prob w/the C prog. lang. book(ANSI C)
Top