Home > Articles > Programming > C/C++

  • Print
  • + Share This
This chapter is from the book

Q&A

  • Q. What does #include do?

  • A. This is a directive to the preprocessor that runs when you call your compiler. This specific directive causes the contents of the file named in <> after #include to be inserted at that line as if it were typed at that location in your source code.

  • Q. What is the difference between // comments and /* comments?

  • A. The double-slash comments (//) expire at the end of the line. Slash-star (/*) comments are in effect until there is a closing comment mark (*/). The double-slash comments are also referred to as single-line comments, and the slash-star comments are often referred to as multiline comments. Remember, not even the end of the function terminates a slash-star comment; you must put in the closing comment mark or you will receive a compile-time error.

  • Q. When do you need to program command-line arguments?

  • A. To allow the user to alter the behavior of a program. For example, the command ls in Linux or dir in Windows enables you to see the contents within the current directory or folder. To view files in another directory, you would specify the path of the same using command-line arguments, as seen in ls / or dir \.

  • + Share This
  • 🔖 Save To Your Account