Welcome to Mobilarian Forum - Official Symbianize forum.

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

1.6

Alexhost
M 0

marckos

Abecedarian
Member
Access
Joined
Jun 25, 2014
Messages
195
Reaction score
31
Points
18
grants
₲9,107
10 years of service
Whitespace is a term that refers to characters that are used for formatting purposes. In C++, this refers primarily to spaces, tabs, and (sometimes) newlines. The C++ compiler generally ignores whitespace, with a few minor exceptions.

Consequently, the following statements all do the exact same thing:

1
2
3
4
5
6
7
8
cout << "Hello world!";

cout << "Hello world!";

cout << "Hello world!";

cout
<< "Hello world!";
Even the last statement with the newline in it compiles just fine.

The following functions all do the same thing:

1
2
3
4
5
6
7
8
9
10
11
12
int add(int x, int y) { return x + y; }

int add(int x, int y) {
return x + y; }

int add(int x, int y)
{ return x + y; }

int add(int x, int y)
{
return x + y;
}
One exception where the C++ compiler does pays attention to whitespace is inside quoted text, such as "Hello world!".

"Hello world!"
is different than

"Hello world!"
and each prints out exactly as you
 
Top Bottom