Hi c.l.c.
I think it's time that I bring it up. Over the last 2-3 months,
I have been trying to build my C FAQ page which has around
40 C questions. Few of them have been adopted from c.l.c. The
same page has 3 Linux questions, and can be ignored. There
are few other sections, too, which are are a little OT here, and can
also be ignored.
(Oh My God! Flames are gonna pour in...)
This is pretty good. The pop-ups from geocities is a little annoying but
the content of your web site is good. Once or twice I have seen replies
you received but there is no credit for who wrote the reply. Not sure why.
You kept the names of most the people who replied to your inquiries.
Question 9: when reading the answer I get the feeling some people might
assume all floating point numbers in C are IEEE 754. They are not. Maybe
put a note at the top of the answer indicating this.
Question 10: starts with 'four important differences' but only lists
three. What happened there? Additionally, I'm not sure the answer you have
posted is really the best answer.
Question 11: this is not a generic C answer. This is answer the question
for a specific compiler on a specific architecture and operating system.
That should be made clear.
Question 12: the definition of memory leak is good but the information on
how to trace a memory leak is very UNIX specific.
Question 16: when you transcribe from a text book it is proper to quote a
proper reference to the book. This would include the author(s), title,
publisher, date of publication, edition and ISBN.
Question 18: this should really be, "Why can't I increment an array like a
pointer?" since that is what the answer is dealing with.
Question 19: there is more to learn here. It shows how changes in a
function do not affect the original variable. Don't you want to know how
you CAN affect the original variable?
Question 20: this is not the most efficient way to allocate the 2-d array.
You have ROW+1 calls to malloc. It would be better to have 2 calls to
malloc. Allocate ROW pointers (one call to malloc). Allocate one large
block of memory (ROW*COLUMN big; one call to malloc). Finally, assign
memory locations inside the large block of memory to the ROW pointers (no
call to malloc). I believe your tutorial on pointers by Ted Jensen uses
the more efficient method.
Additionally, you have no error checking as you allocate the rows in the
for loop.
Question 23: not nice. First, don't start function and variable names with
underscore. Second, put some notes about how this only works if your
compiler is using ASCII characters. With that restriction and those
already part of the quiz the answer becomes much easier than what you
have.
Question 30: could use a little work. It is not immediately clear that
'#pragma once' is a specific use of the #pragma directive and that the
#pragma directive can have many implementation defined uses.
Question 37: (I'm skimming now) this could be better written. If the input
to del_node is an empty list, i.e. ptr == NULL then the first if statement
will crash.
All in all a good collection of answers to questions. Some of the
questions are more about figuring it out then the actual final answer,
e.g. question 21. I would not post the answers to these.