MCPcopy Create free account
hub / github.com/changkun/modern-cpp-tutorial / main

Function main

code/4/4.1.cpp:18–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}
17
18int main() {
19 std::array<int, 4> arr= {1,4,3,2};
20
21 //int len = 4;
22 //std::array<int, len> arr = {1,2,3,4}; // 非法, 数组大小参数必须是常量表达式
23
24 // C 风格接口传参
25 // foo(arr, arr.size()); // 非法, 无法隐式转换
26 foo(&arr[0], arr.size());
27 foo(arr.data(), arr.size());
28
29 // 更多接口使用
30 std::sort(arr.begin(), arr.end());
31 for(auto &i : arr)
32 std::cout << i << std::endl;
33
34 return 0;
35}

Callers

nothing calls this directly

Calls 1

fooFunction · 0.70

Tested by

no test coverage detected