C++傳遞數組給函數

通常方法 C++ 傳數組給一個函數,能夠傳數組的首地址和長度:ios #include <iostream> using namespace std; int sum_arr(const int arr[], int n) { int total = 0; for(int i = 0; i < n; i++) { total += arr[i];
相關文章
相關標籤/搜索