A
Army1987
And replace printf() with another few putchar()s...Whoops...
Remove the headers and 'void'.
And replace printf() with another few putchar()s...Whoops...
Remove the headers and 'void'.
Richard said:Joe Wright said:
Watta ya wanna bet?Keith said:[...]
3. All constants must be in uppercase
[...]
Quibble: All the digits are already upper case, no lower case digit
exists.
Meta-quibble: Digits are neither upper case nor lower case.
isupper('5') and islower('5') both return 0.
The farm.
isupper() and islower() treat only isalpha()
values. Just a guess. I haven't looked it up.
I have (although I knew it already - but where a bet is concerned, I
look it up anyway). Both isupper and islower are required to return 0
for digit characters.
You owe me a farm.
Charlton said:p> It was OP's second statement which was inflammatory: "Hi, I'm
p> currently taking a data structures course in C, and my teacher
p> said that function prototypes are not allowed in any of our
p> code. He also said that no professional programmers use
p> function prototypes."
Right, but the only evidence we have of that is a student's say so;
and given the choice between a professor really being that
out-of-touch and a student misunderstanding, smart money's on the
student misunderstanding.
Eric said:In a follow-up, the student provided a whole list of rules
and requirements. I tend to believe these were probably copied
verbatim from something the teacher handed out, and thus are a
reasonably accurate representation of the teacher's instructions.
The posted rules do not include the stupid remark about
professional programmers, but they do offer evidence that the
teacher does not know what a prototype is, or that if he does
he chooses to use sloppy and misleading language anyhow.
CBFalconer said:A proper function declaration/definition also creates a prototype,
with no separate lump of verbiage. Nothing to ensure matching
with, etc. You just have to relax your normally more precise
verbiage, and put yourself in the position of the students and
instructor.
CBFalconer said:Similarly, the posted full rules were never intended for c.l.c, but
for a collection of totally ignorant youthful students. For here,
it might have been worded much differently.
CBFalconer said:Pure prototypes are not needed if you are not connecting to other
files, nor using some forms of recursion. Simply writing the code
in a logical order suffices.
Richard said:.... snip ...
Nor do I find a double .sig logical.
Stephen said:CBFalconer said:Keith said:[...]
3. All constants must be in uppercase
[...]
Quibble: All the digits are already upper case, no lower case
digit exists.
Meta-quibble: Digits are neither upper case nor lower case.
isupper('5') and islower('5') both return 0.
Yabut silly requibble: toupper('6') returns '6', must be upper
tolower('6') returns '6', must be lower
Keith said:And what would be wrong with using terms correctly in a handout
intended for ignorant students, so they won't have to unlearn anything
later on?
Some of them might not be all that ignorant. For example, some of
them just might post to comp.lang.c to find out what the instructor
really meant.
Sure, but what are the odds of that happening?
Richard said:[...]
You'd think a teacher would know the difference between "principle"
and "principal", wouldn't you?
I blam our flawhed eductaional sistym!
Ravishankar said:....snip...
just a little off topic:
Would the compilation also be faster if all headers were included in a gaint
header file ?
Steph said:I dont think I misunderstood, here are the course guidelines quite clear
about this.
"During this semester, all programs submitted for homework or extra
credit and the project must conform to the following programming
standards:
1. Use of global variables is prohibited
2. All variables must be in lower case, with clear and concise names
that depict what data the varible will contain.
3. All constants must be in uppercase
4. Use of global constants, such as PI, is permitted
5. Use of function prototypes is prohibited. As such, all functions
must appear in reverse order of use, with the function main() being
the last function in the program.
6. Internal documentation for programs must include data range
specifications for each variable.
7. Before each function a short narrative must be included that
describes the purpose of the function, pre-conditions that must exist
for the function, what data the function returns and by what method
the data is returned, and who developed and programmed the function
which must, include email contact information..
8. At the top of the main source file, a narrative must be included
that describes the purpose of the program, who was the principle
programmer on the programming team. If the program went through
several revisions, a revision history must be included.
9. If "include" files are used, each "include" file must conform to
items 1 to 8."
Flash said:Kenneth Brody wrote, On 27/08/07 18:16:
No idea, but it does happen because this thread was as a result of one
of the students posting here asking about it!
s/typedef/typedef enum/Alas, the constant in the `return' statement is not
in upper case. Suggested fix:
typedef { TRUE, FALSE } Boolean;
...
return TRUE;
;-)
Ditto.
(Disclaimer: I didn't invent the `typedef', but ran
across it years ago in somebody else's code. It made for
an interesting debugging session ...)
I was granting that he meant prototypes in source code.
putchar and puts, along with getchar and <ALARM! DON'T USE>gets, canBut if you take him literally to just mean
making use of prototypes in code, then yes,
I don't think you can write a program for a modern C implementation,
that has any output, without using prototypes.
That's not a valid reason. The nonprototype aka oldstyle aka K&R1:
Of course I have such a reason. The instructor's programs wouldn't work
otherwise, all he could do is write functions that returned an int or
returned nothing. I have already agreed the instructor shouldn't have said
what he said. What do you want, blood?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.