Advertisement
35657

Untitled

Mar 30th, 2024
609
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1.  
  2. #include <iostream>
  3.  
  4.  
  5. using namespace std;
  6.  
  7. // равносильно print(int arr[], int size)
  8. void print(int* arr, int size) {
  9.     for (int i = 0; i < size; i++) {
  10.         cout << *(arr + i) << " ";
  11.     }
  12.     cout << endl;
  13. }
  14.  
  15.  
  16. int main() {
  17.     setlocale(LC_ALL, "ru");
  18.  
  19.     const int size = 5;
  20.  
  21.     int arr[size]{ 33,45,67,22,38 };
  22.  
  23.     print(arr, size);
  24.  
  25.     *(arr + 3) = 128;
  26.  
  27.     print(arr, size);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement