Skip to content

Instantly share code, notes, and snippets.

@chenbo515
Created May 25, 2022 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chenbo515/8848973ac5a9c8ac60b2af46be0c83e1 to your computer and use it in GitHub Desktop.
Save chenbo515/8848973ac5a9c8ac60b2af46be0c83e1 to your computer and use it in GitHub Desktop.
comment counter
/*
*********** DO NOT CHANGE OR COMMIT THIS FILE ***********
Special cases that you'll need to handle.
There are:
- 5 single-line comments
- 23 multiple-line comments
*/
main()
{
printf(
"// This is not a comment"
"// This is not a comment\
// This is not a comment" // Comment: single
"// This is not a comment \" not a comment as well"
"/* This is not a comment */"
"/* This is not a comment \
This is not a comment */"
"This is not a comment */"
"// This line has a trailing comment" // Comment: \
single (the line-break makes this one counted as 2 lines)
); /* Comment: multiple
Comment: multiple
Comment: multiple
*/ int x = 0; // Comment: multiple, single
/*
Comment: multiple
*/ int y = 1; /*
Comment: multiple */
}
/* Comment: multiple
Comment: multiple \
/* Comment: multiple
/* Comment: multiple
/* Comment: multiple
Comment: multiple */ // Comment: single // Not another single-line comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment