-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
42 lines (31 loc) · 866 Bytes
/
Main.cpp
File metadata and controls
42 lines (31 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>
#include <string>
#include <stdlib.h>
#define LOG(msg) std::cout << msg <<std::endl
int main()
{
// string literal with length 7 (with NULL)
"Cherno";
// const char array
// can only be changed later without "const"
const char name[7] = "Cherno";
// const char pointer
const char* name2 = "Cherno";
const char* name3 = u8"Cherno";
// white character
const wchar_t* name4 = L"Cherno";
const char16_t* name5 = u"Cherno";
const char32_t* name6 = U"Cherno";
using namespace std::string_literals;
// s after string literal allows another string to be added to its end
std::string name7 = "Cherno"s + " hello";
std::u32string name8 = U"Cherno"s + U" hello";
// <- stands for raw
const char* example = R"(STUFF1
Line2
Lin3)";
std::cin.get();
}
/*
* string literals are always in read only memory
*/