Skip to content

Instantly share code, notes, and snippets.

@mrcat323
Created January 13, 2020 11:55
Show Gist options
  • Save mrcat323/4cc6fde3224686e5d04a7907ba31001a to your computer and use it in GitHub Desktop.
Save mrcat323/4cc6fde3224686e5d04a7907ba31001a to your computer and use it in GitHub Desktop.
No-Comments task
#include <stdio.h>
#define EOL '\n'
int main(void)
{
int i, c, p;
while ((c = getchar()) != EOF) {
if (c == '/') {
if ((i = getchar()) == '/') {
while ((p = getchar()) != EOL)
putchar(p);
} else if ((i = getchar()) == '*') {
while ((p = getchar()) != '*')
putchar(p);
}
} else if (c == '"') {
while ((p = getchar()) != '"') {
putchar(p);
}
} else if (c == '*')
continue;
else {
putchar(c);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment