Skip to content

Instantly share code, notes, and snippets.

@tornikegomareli
Created May 5, 2017 07:50
Show Gist options
  • Save tornikegomareli/e68888e53f9f823cc03540e0984aff67 to your computer and use it in GitHub Desktop.
Save tornikegomareli/e68888e53f9f823cc03540e0984aff67 to your computer and use it in GitHub Desktop.
Array Initialization with pointers #164
#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