Close

2021-07-12

Why and when do we use the #define directive?

Why and when do we use the #define directive?

The #define directive is used to define values or macros that are used by the preprocessor to manipulate the program source code before it is compiled. Because preprocessor definitions are substituted before the compiler acts on the source code, any errors that are introduced by #define are difficult to trace.

What is the purpose of using the directive define?

The #define directive causes the compiler to substitute token-string for each occurrence of identifier in the source file. The identifier is replaced only when it forms a token. That is, identifier is not replaced if it appears in a comment, in a string, or as part of a longer identifier.

Why the #define directive is used Mcq?

Explanation: The #ifdef preprocessor directive is used to check if a particular identifier is currently defined or not. If the particular identifier is defined, the statements following this preprocessor directive are executed till another preprocessor directive #endif is encountered.

When to use #define C++?

The #define command is used to make substitutions throughout the file in which it is located. In other words, #define causes the compiler to go through the file, replacing every occurrence of macro-name with replacement-string. The replacement string stops at the end of the line.

Do you use semicolons?

Use a semicolon to join two related independent clauses in place of a comma and a coordinating conjunction (and, but, or, nor, for, so, yet). Make sure when you use the semicolon that the connection between the two independent clauses is clear without the coordinating conjunction.

Can you use a semicolon before but?

It is generally considered acceptable to place a semicolon before and or but in order to break up a very long sentence, especially when there are already multiple commas/clauses.

Did I use a semicolon correctly checker?

If you want to check whether or not you’re using a semicolon correctly, just read the two clauses on their own and see if they make sense. If they don’t, it’s a miss. A semicolon fixes that because it allows the independent clauses to stand on their own, while still showing that they’re connected.

What words do you use a semicolon after?

2. Use a semicolon between independent clauses linked with a transitional expression.

accordingly finally similarly
besides however subsequently
certainly incidentally the
consequently indeed therefore
conversely instead thu

What three main things can semicolons replace when being used?

Semicolon Usage: The Three Functions of Semicolons in Written English

  • Semicolons.
  • Join two related independent clauses of equal emphasis.
  • Join two independent clauses in which the second clause begins with an adverb or short parenthetical.
  • Separate items that contain commas in a series.

What are the three semicolon rules?

Deadline: Thursday, June 17th

  • Rule 1: Use a semicolon between independent clauses that are closely related in theme.
  • Rule 2: Use a semicolon before conjunctive adverbs and transitional phrases that join independent clauses.

Should you capitalize the first word after a semicolon?

Do not capitalize the first word in a list after a semicolon unless the word is a proper noun, e.g., During Julie’s vacation, she visited many Canadian cities, including St. Capitalize an author’s name after a semicolon in a multi-author citation, e.g., (Brown & Lee, 2010; Johnson & Smith, 2009).

Do you put a capital after a comma?

Member. When writing a sentence that is separated by a comma, you would only capitalize the first word after the comma if it were a proper noun.

Should a colon be followed by a capital letter?

A colon is nearly always preceded by a complete sentence; what follows the colon may or may not be a complete sentence, and it may be a mere list or even a single word. A colon is not normally followed by a capital letter in British usage, though American usage often prefers to use a capital.

Can you use a colon after one word?

The colon can be used to emphasize a phrase or single word at the end of a sentence. Conclusion: This practice can be followed when that single word is at either end of the sentence.

When should you not use a colon?

Do not use a colon in a complete sentence after phrases such as “such as,” “including,” and “for example.” Because phrases like these already indicate to the reader that a list of examples will follow, there is no need to introduce them with a colon, which would merely be redundant.

How do you use a full colon?

The colon is used to separate two independent clauses when the second explains or illustrates the first. In such usage, the colon functions in much the same way as the semicolon. As with the semicolon, do not capitalize the first word after the colon unless the word is ordinarily capitalized.

When should a colon be used?

You can use a colon to connect two sentences when the second sentence summarizes, sharpens, or explains the first. Both sentences should be complete, and their content should be very closely related. Note that if you use colons this way too often, it can break up the flow of your writing.

Do I use a colon before a list?

It is therefore correct to use a colon before the list. This means that no colon is needed and it would be incorrect to use one before the list. So if you have a list, remember you only use a colon before it if the list follows a clause that could be used on its own.

Can a colon follow a question mark?

Short answer: You can strike out the colon and keep the question mark. With a colon after a question mark, the tile would appear very awkward – firstly because of how the characters appear.