Ask Your Question
0

What are the methods for keeping a one-line code expression in C++ from being separated into multiple lines by VS Code?

asked 2023-07-16 16:25:15 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-07-16 16:38:01 +0000

qstack gravatar image

There are a few methods you can use to keep a one-line code expression in C++ from being separated into multiple lines by VS Code:

  1. Use the backslash () character at the end of the line to indicate that the expression continues on the next line:
int sum = 1 + 2 \
          + 3 + 4;
  1. Use parentheses to group the expression:
int sum = (1 + 2
          + 3 + 4);
  1. Use the backslash and parentheses together:
int sum = (1 + 2 \
          + 3 + 4);
  1. Increase the width of the text editor window to allow for longer lines.
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-16 16:25:15 +0000

Seen: 10 times

Last updated: Jul 16 '23