Barry Schwarz
2010-12-09 04:54:08 UTC
On Tue, 7 Dec 2010 20:02:15 -0800 (PST), HumbleWorker
<***@gmail.com> wrote:
>Can anybody go through these solutions and give me a feedback. These
>compile on Visual C++ compiler. Some of them are in C language, so you
>should use .c extension. All these problems are on _cgets function.
>
>http://www.hoven.in/hoven.ashx?I=n90
In example 1:
Why does your function set cBuff[0] to the wrong value?
If the length of input is not 5, why does you your function
waste time examining the characters?
Why does your function try to remove "excess input" when the
specification for _cgets says it already did so?
Why, when attempting to do so does your function call _gets
with an incorrect value in cBuff[0].
What makes you think cReturn[0] will ever be 0?
Why does your main function return 0 when invalid input is
detected?
In example 2:
Why does you comment address digits when the requirement is to
enter a word?
In example 4:
Why is there a mismatch between the format specification and
the value passed to printf?
In example 5:
Where is the range check performed?
--
Remove del for email
<***@gmail.com> wrote:
>Can anybody go through these solutions and give me a feedback. These
>compile on Visual C++ compiler. Some of them are in C language, so you
>should use .c extension. All these problems are on _cgets function.
>
>http://www.hoven.in/hoven.ashx?I=n90
In example 1:
Why does your function set cBuff[0] to the wrong value?
If the length of input is not 5, why does you your function
waste time examining the characters?
Why does your function try to remove "excess input" when the
specification for _cgets says it already did so?
Why, when attempting to do so does your function call _gets
with an incorrect value in cBuff[0].
What makes you think cReturn[0] will ever be 0?
Why does your main function return 0 when invalid input is
detected?
In example 2:
Why does you comment address digits when the requirement is to
enter a word?
In example 4:
Why is there a mismatch between the format specification and
the value passed to printf?
In example 5:
Where is the range check performed?
--
Remove del for email