473,399 Members | 3,656 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

K&R Answers?

I recall someone posting a website that had the complete K&R (2nd Ed.
- ANSI) answers posted but I cannot find the post.

Zach
Mar 16 '08 #1
15 1956
Zach said:
I recall someone posting a website that had the complete K&R (2nd Ed.
- ANSI) answers posted but I cannot find the post.
Not complete (if I recall correctly) - but the Web site you're looking for
is:

<http://clc-wiki.net/wiki/K%26R2_solutions>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Mar 16 '08 #2
On Mar 15, 8:09 pm, Richard Heathfield <r...@see.sig.invalidwrote:
Zach said:
I recall someone posting a website that had the complete K&R (2nd Ed.
- ANSI) answers posted but I cannot find the post.

Not complete (if I recall correctly) - but the Web site you're looking for
is:

<http://clc-wiki.net/wiki/K%26R2_solutions>
Thanks Richard.

Zach
Mar 16 '08 #3

"Zach" <ne****@gmail.comwrote in message
news:3c**********************************@n75g2000 hsh.googlegroups.com...
On Mar 15, 8:09 pm, Richard Heathfield <r...@see.sig.invalidwrote:
>Zach said:
I recall someone posting a website that had the complete K&R (2nd Ed.
- ANSI) answers posted but I cannot find the post.

Not complete (if I recall correctly) - but the Web site you're looking
for
is:

<http://clc-wiki.net/wiki/K%26R2_solutions>

Thanks Richard.

Zach
There's a worthwhile hard-copy available. _The C Solution Book_ About 3/8"
thick and fewer errata than the covers of Unleashed.

I'm curious what's at that link.
--
"A man is accepted into church for what he believes--and turned out for
what he knows."

-Mark Twain
Mar 16 '08 #4
stop wrote:
>
"Zach" <ne****@gmail.comwrote in message
news:3c**********************************@n75g2000 hsh.googlegroups.com...
>On Mar 15, 8:09 pm, Richard Heathfield <r...@see.sig.invalidwrote:
>>Zach said:

I recall someone posting a website that had the complete K&R (2nd
Ed. - ANSI) answers posted but I cannot find the post.

Not complete (if I recall correctly) - but the Web site you're
looking for
is:

<http://clc-wiki.net/wiki/K%26R2_solutions>

Thanks Richard.
There's a worthwhile hard-copy available. _The C Solution Book_
About 3/8" thick and fewer errata than the covers of Unleashed.
Do you mean /The C Answer Book/ by Clovis & Tondo?
I'm curious what's at that link.
Solutions to some of the exercises in K&R2, contributed by various clc
participants.

Mar 16 '08 #5
Zach wrote:
I recall someone posting a website that had the complete K&R (2nd Ed.
- ANSI) answers posted but I cannot find the post.

Well about a K&R2 exercise posted in another thread. I think the answer:

http://clc-wiki.net/wiki/K%26R2_solu...r_2:Exercise_1

#include <stdio.h>
#include <limits.h>

int
main ()
{
printf("Size of Char %d\n", CHAR_BIT);
printf("Size of Char Max %d\n", CHAR_MAX);
printf("Size of Char Min %d\n", CHAR_MIN);
printf("Size of int min %d\n", INT_MIN);
printf("Size of int max %d\n", INT_MAX);
printf("Size of long min %ld\n", LONG_MIN); /* RB */
printf("Size of long max %ld\n", LONG_MAX); /* RB */
printf("Size of short min %d\n", SHRT_MIN);
printf("Size of short max %d\n", SHRT_MAX);
printf("Size of unsigned char %u\n", UCHAR_MAX); /* SF */
printf("Size of unsigned long %lu\n", ULONG_MAX); /* RB */
printf("Size of unsigned int %u\n", UINT_MAX); /* RB */
printf("Size of unsigned short %u\n", USHRT_MAX); /* SF */

return 0;
}
is wrong and a bit incomplete.
I think the correct one is:
#include <stdio.h>
#include <limits.h>

int main ()
{
printf("Size of Char %d\n", CHAR_BIT);
printf("Size of Char Max %d\n", CHAR_MAX);
printf("Size of Char Min %d\n", CHAR_MIN);
printf("Size of int min %d\n", INT_MIN);
printf("Size of int max %d\n", INT_MAX);
printf("Size of long min %ld\n", LONG_MIN); /* RB */
printf("Size of long max %ld\n", LONG_MAX); /* RB */
printf("Size of short min %d\n", SHRT_MIN);
printf("Size of short max %d\n", SHRT_MAX);
== printf("Size of unsigned char max %u\n", (unsigned) UCHAR_MAX);
== printf("Size of unsigned long max %lu\n", ULONG_MAX); /* RB */
== printf("Size of unsigned int max %u\n", UINT_MAX); /* RB */
== printf("Size of unsigned short max %u\n", USHRT_MAX); /* SF */

return 0;
}
Mar 16 '08 #6
Ioannis Vranos wrote:
Zach wrote:
>I recall someone posting a website that had the complete K&R (2nd Ed.
- ANSI) answers posted but I cannot find the post.


Well about a K&R2 exercise posted in another thread. I think the answer:

http://clc-wiki.net/wiki/K%26R2_solu...r_2:Exercise_1

#include <stdio.h>
#include <limits.h>

int
main ()
{
printf("Size of Char %d\n", CHAR_BIT);
printf("Size of Char Max %d\n", CHAR_MAX);
printf("Size of Char Min %d\n", CHAR_MIN);
printf("Size of int min %d\n", INT_MIN);
printf("Size of int max %d\n", INT_MAX);
printf("Size of long min %ld\n", LONG_MIN); /* RB */
printf("Size of long max %ld\n", LONG_MAX); /* RB */
printf("Size of short min %d\n", SHRT_MIN);
printf("Size of short max %d\n", SHRT_MAX);
printf("Size of unsigned char %u\n", UCHAR_MAX); /* SF */
printf("Size of unsigned long %lu\n", ULONG_MAX); /* RB */
printf("Size of unsigned int %u\n", UINT_MAX); /* RB */
printf("Size of unsigned short %u\n", USHRT_MAX); /* SF */

return 0;
}
is wrong and a bit incomplete.
I think the correct one is:

More:

#include <stdio.h>
#include <limits.h>

int main ()
{
== printf("Bits of Char %d\n", CHAR_BIT);
printf("Size of Char Max %d\n", CHAR_MAX);
printf("Size of Char Min %d\n", CHAR_MIN);
printf("Size of int min %d\n", INT_MIN);
printf("Size of int max %d\n", INT_MAX);
printf("Size of long min %ld\n", LONG_MIN); /* RB */
printf("Size of long max %ld\n", LONG_MAX); /* RB */
printf("Size of short min %d\n", SHRT_MIN);
printf("Size of short max %d\n", SHRT_MAX);
== printf("Size of unsigned char max %u\n", (unsigned) UCHAR_MAX);
== printf("Size of unsigned long max %lu\n", ULONG_MAX); /* RB */
== printf("Size of unsigned int max %u\n", UINT_MAX); /* RB */
== printf("Size of unsigned short max %u\n", USHRT_MAX); /* SF */

return 0;
}
Mar 16 '08 #7
Ioannis Vranos said:

<snip>
>
Well about a K&R2 exercise posted in another thread. I think the answer:

http://clc-wiki.net/wiki/K%26R2_solu...r_2:Exercise_1
<snip>
>
is wrong and a bit incomplete.
Then why not submit your own version to the C wiki?

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Mar 16 '08 #8
Richard Heathfield wrote:
Ioannis Vranos said:

<snip>
>Well about a K&R2 exercise posted in another thread. I think the answer:

http://clc-wiki.net/wiki/K%26R2_solu...r_2:Exercise_1
<snip>
>is wrong and a bit incomplete.

Then why not submit your own version to the C wiki?

I can't find out how to create an account.

Mar 16 '08 #9
Richard Heathfield wrote:
>
Then why not submit your own version to the C wiki?

OK, I edited the text.
Mar 16 '08 #10
Ioannis Vranos wrote, On 16/03/08 15:45:
Richard Heathfield wrote:
>Ioannis Vranos said:

<snip>
>>Well about a K&R2 exercise posted in another thread. I think the answer:

http://clc-wiki.net/wiki/K%26R2_solu...r_2:Exercise_1
<snip>
>>is wrong and a bit incomplete.

Then why not submit your own version to the C wiki?

I can't find out how to create an account.
There is a box in the top right corner which when you hover the mouse
over it will give you the login/creat account options. Alternatively
alt+shift+O should work. Email me if you still have problems.
--
Flash Gordon
Providing the server for the CLC Wiki
Mar 16 '08 #11
Ioannis Vranos <iv*****@nospam.no.spamfreemail.grwrites:
Zach wrote:
>I recall someone posting a website that had the complete K&R (2nd Ed.
- ANSI) answers posted but I cannot find the post.

Well about a K&R2 exercise posted in another thread. I think the answer:

http://clc-wiki.net/wiki/K%26R2_solu...r_2:Exercise_1

#include <stdio.h>
#include <limits.h>

int
main ()
{
printf("Size of Char %d\n", CHAR_BIT);
printf("Size of Char Max %d\n", CHAR_MAX);
printf("Size of Char Min %d\n", CHAR_MIN);
printf("Size of int min %d\n", INT_MIN);
printf("Size of int max %d\n", INT_MAX);
printf("Size of long min %ld\n", LONG_MIN); /* RB */
printf("Size of long max %ld\n", LONG_MAX); /* RB */
printf("Size of short min %d\n", SHRT_MIN);
printf("Size of short max %d\n", SHRT_MAX);
printf("Size of unsigned char %u\n", UCHAR_MAX); /* SF */
printf("Size of unsigned long %lu\n", ULONG_MAX); /* RB */
printf("Size of unsigned int %u\n", UINT_MAX); /* RB */
printf("Size of unsigned short %u\n", USHRT_MAX); /* SF */

return 0;
}
is wrong and a bit incomplete.
I think the correct one is:
[snip]

The more serious problem is that the messages are worded incorrectly.
It prints, for example (on my system):

Size of int max 2147483647

2147483647 is not a size, it's an upper bound.

The two lines
printf("Size of int min %d\n", INT_MIN);
printf("Size of int max %d\n", INT_MAX);
should be replaced with something like:
printf("Range of int is %d to %d\n", INT_MIN, INT_MAX);

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Mar 16 '08 #12
Keith Thompson wrote:
>
The more serious problem is that the messages are worded incorrectly.
It prints, for example (on my system):

Size of int max 2147483647

2147483647 is not a size, it's an upper bound.

The two lines
printf("Size of int min %d\n", INT_MIN);
printf("Size of int max %d\n", INT_MAX);
should be replaced with something like:
printf("Range of int is %d to %d\n", INT_MIN, INT_MAX);

Fixed. I think your contribution is made clear in the text, if not
please post a reply.

Mar 16 '08 #13


"santosh" <sa*********@gmail.comwrote in message
news:fr**********@registered.motzarella.org...
stop wrote:
>>
"Zach" <ne****@gmail.comwrote in message
news:3c**********************************@n75g2000 hsh.googlegroups.com...
>>On Mar 15, 8:09 pm, Richard Heathfield <r...@see.sig.invalidwrote:
Zach said:

I recall someone posting a website that had the complete K&R (2nd
Ed. - ANSI) answers posted but I cannot find the post.

Not complete (if I recall correctly) - but the Web site you're
looking for
is:

<http://clc-wiki.net/wiki/K%26R2_solutions>

Thanks Richard.
>There's a worthwhile hard-copy available. _The C Solution Book_
About 3/8" thick and fewer errata than the covers of Unleashed.

Do you mean /The C Answer Book/ by Clovis & Tondo?
Yup. I dug it out today while I was moving crates of books. It's more like
5/8".

The authors are Tondo and Gimpel. Mr. Tondo's first name is Clovis. I'm
reasonably certain I've never met a Clovis before.

--
"A man is accepted into church for what he believes--and turned out for
what he knows."

-Mark Twain
Mar 17 '08 #14
stop wrote:
"santosh" <sa*********@gmail.comwrote in message
news:fr**********@registered.motzarella.org...
<snip>
>Do you mean /The C Answer Book/ by Clovis & Tondo?
Yup. I dug it out today while I was moving crates of books. It's
more like 5/8".

The authors are Tondo and Gimpel. Mr. Tondo's first name is Clovis.
I'm reasonably certain I've never met a Clovis before.
You are right, thanks.

Mar 18 '08 #15
Richard Heathfield wrote:
stop said:
>My canonical example for what is ungoogleable is finding out about the
coffee trade on the island of java. I think ungoogleable results would
make
an amusing compendium. I just thought of another: Hormel products.

C itself can be fairly ghastly to "google" for. The worst part of the C
language is its name.
I like the name. Especially since it's one of those funky recursive
acronyms. It stands for "C" :)
Mar 18 '08 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

65
by: perseus | last post by:
I think that everyone who told me that my question is irrelevant, in particular Mr. David White, is being absolutely ridiculous. Obviously, most of you up here behave like the owners of the C++...
12
by: jeffc | last post by:
Can anyone point me to a web site that gives technical reasons that pass by value is preferred over pass by reference when the value is not to be changed? Actually it could be any built-in "small"...
115
by: Mark Shelor | last post by:
I've encountered a troublesome inconsistency in the C-language Perl extension I've written for CPAN (Digest::SHA). The problem involves the use of a static array within a performance-critical...
11
by: Daniel Haude | last post by:
....and I must say I don't regret it. But having lurked (and occasionally posted) for years in this group, having read and understood the C FAQ, and having perused the Standard quite a bit I must...
83
by: newby2c | last post by:
My personal K&R (3rd edition) wish list: 1. That a 3rd edition is actually published! 2. Make any and all corrections from earlier editions. 3. Update to comply with the c99 Standard. 4. A...
4
by: Werner | last post by:
Hello I have a VC7 App consisting of "old" MFC-Source and new Manged Source that uses an OC in one of its MFC-based dialogs When started, AfxOleInit (called in InitInstance) fails with a message...
1
by: robertmeyer1 | last post by:
Hi, I have 3 tables set up. tblQuestion, tblAnswer, tblClient. I have them linked together and have a sbf and mainform set up for data entry. The sbf links the questions and answers together. ...
2
by: sani8888 | last post by:
Hi everybody I am a beginner with C++ programming. And I need some help. How can I start with this program *********** The program is using a text file of information as the source of the...
2
by: nivedita | last post by:
Hi All, I want to dot net interview question with answer if any one have question with answer please send me.. i am fresher Thanks in advance.. Nivedita
82
by: arnuld | last post by:
PURPOSE :: see statement in comments GOT: Segmentation Fault I guess the segfault is sourced in the compile-time warning but I am giving a char* to the function already.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.