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_solution s>
--
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
>On Mar 15, 8:09 pm, Richard Heathfield <r...@see.sig.i nvalidwrote:
>>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_solution s>
>>
>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.
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 */
>
#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;
}
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
>>
>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
>
#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_Keit h) <kst-u@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
>
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.
>>On Mar 15, 8:09 pm, Richard Heathfield <r...@see.sig.i nvalidwrote:
>>>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_solution s>
>>>
>>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."
"santosh" <santosh.k83@gm ail.comwrote in message
news:fri6kr$n8n $2@registered.m otzarella.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.
Comment