일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- attribute
- 715. Range Module
- Python Implementation
- Substring with Concatenation of All Words
- 43. Multiply Strings
- t1
- 프로그래머스
- 밴픽
- iterator
- Protocol
- 315. Count of Smaller Numbers After Self
- 파이썬
- 운영체제
- data science
- 시바견
- 30. Substring with Concatenation of All Words
- Generator
- kaggle
- Convert Sorted List to Binary Search Tree
- Python Code
- 109. Convert Sorted List to Binary Search Tree
- shiba
- DWG
- Regular Expression
- Class
- concurrency
- LeetCode
- Decorator
- 컴퓨터의 구조
- Python
Archives
- Today
- Total
Scribbling
[C++] Chapter 2: Types 본문
1. Function types
a) return type: int, arg type: double (function)
int func(double)
int (double)
b) return type: &int[2][3], arg type: double (function)
int (*func(double))[2][3]
int (*(double))[2][3]
c) return type: function pointer of (b), arg type: double (function pointer)
int (*(*)(double))[2][3]
d) return type: int[2][3], arg type: vector<double> (function)
int (std::vector<double>)[2][3]
2. typedef
typedef int(*ARRAY2D_POINTER)[2][3];
above defines "ARRAY2D_POINTER" as int* [2][3]
3. Pointer
void main() {
int* arr[2];
int x = 1;
int y = 2;
arr[0] = &x;
arr[1] = &y;
cout << *arr[0] << endl;
int** brr = new int*[2];
brr[0] = &x;
brr[1] = &y;
cout << *brr[0] << endl;
delete[] brr;
}
4. const
void main() {
// all elements are const
const int arr[3] = { 1, 2, 3 };
// *cp is const
int a = 3;
const int* cp;
cp = &a;
// cp is const
int* const cp = &a;
}
5. auto
void main() {
vector<int> v = { 1, 2, 3 };
int sum = 0;
// auto : vector<int>::iterator
for (auto it = v.begin(); it != v.end(); it++) {
sum += *it;
}
cout << sum << endl;
}
'Computer Science > C++' 카테고리의 다른 글
[C++] to_string, deque, string split (0) | 2023.08.24 |
---|---|
[C++] istringstream (0) | 2023.08.22 |
[C++] Load Balancing (0) | 2023.08.19 |
[C++] lower_bound, upper_bound (0) | 2023.08.18 |
[C++] isalnum, tolower (0) | 2023.08.18 |