K&R2 1-23
From: Merrill & Michele (beckjensen_at_comcast.net)
Date: 12/06/04
- Next message: freemail: "test"
- Previous message: Lawrence Kirby: "Re: What kind of operator is ( ), [ ] ? unary or binary ?"
- Next in thread: Michael Mair: "Re: K&R2 1-23"
- Reply: Michael Mair: "Re: K&R2 1-23"
- Reply: Chris Croughton: "Re: K&R2 1-23"
- Reply: CBFalconer: "Re: K&R2 1-23"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 6 Dec 2004 12:05:48 -0600
The exercise is to remove all comments from a source file. What I've
written so far is:
/* decommentizer: removes this style of comment from source */
#include <stdio.h>
void strconst(char);
void quotestr(char);
void decomment(void);
int main(void)
{
int c;
while((c = getchar())) != EOF)
{
I'm not sure if I've thought correctly through the cases. For example, I'm
reasonably certain that the function that handles quoted strings will simply
putchar() until it hits another " . I've got myself talked into the same
being the case with character constants. If so, I could reduce the number
of prototype declarations above and either pass " or ' and have the called
function do the same thing. My other question is what other ISO-conforming,
syntactically-legal things can follow a / besides an * . I don't believe
that / is an answer to this question. MPJ
- Next message: freemail: "test"
- Previous message: Lawrence Kirby: "Re: What kind of operator is ( ), [ ] ? unary or binary ?"
- Next in thread: Michael Mair: "Re: K&R2 1-23"
- Reply: Michael Mair: "Re: K&R2 1-23"
- Reply: Chris Croughton: "Re: K&R2 1-23"
- Reply: CBFalconer: "Re: K&R2 1-23"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|