-
-
Save tornikegomareli/e68888e53f9f823cc03540e0984aff67 to your computer and use it in GitHub Desktop.
Array Initialization with pointers #164
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <stdlib.h> | |
| #include <time.h> | |
| using namespace std; | |
| void Init(int* Arr, int Size) | |
| { | |
| for (int i = 0; i < Size; i++) | |
| { | |
| *(Arr + i) = rand() % 100; | |
| } | |
| } | |
| void Print(int* Arr, int Size) | |
| { | |
| for (int i = 0; i < Size; i++) | |
| { | |
| cout << *(Arr + i) << " "; | |
| } | |
| } | |
| int main() | |
| { | |
| const int Size = 20; | |
| int Array[Size]; | |
| int*N = Array; | |
| Init(N, Size); | |
| Print(N, Size); | |
| cin.get(); | |
| cin.get(); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment