Which line of code represents a single line comment in Arduino C/C++?

Study for the Internet of Things (IOT102) Test. Access comprehensive flashcards and multiple choice questions, each with hints and explanations. Get prepared for your exam!

Multiple Choice

Which line of code represents a single line comment in Arduino C/C++?

Explanation:
In Arduino C/C++, a single-line comment is written with two forward slashes and anything after them on the same line is ignored by the compiler. This lets you add notes or explanations without affecting how the program runs. You can place the slashes after some code on the same line, like int ledPin = 13; // LED pin, or have a line that is just the comment. For comments that span multiple lines, you’d use a different form: /* ... */. The other options describe actual code constructs or are unrelated, so they aren’t comments.

In Arduino C/C++, a single-line comment is written with two forward slashes and anything after them on the same line is ignored by the compiler. This lets you add notes or explanations without affecting how the program runs. You can place the slashes after some code on the same line, like int ledPin = 13; // LED pin, or have a line that is just the comment. For comments that span multiple lines, you’d use a different form: /* ... */. The other options describe actual code constructs or are unrelated, so they aren’t comments.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy