Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- typedef int *numbers;
- void assign(int arg[], int &argl);
- void print(int arg[], int &argl);
- int main()
- {
- numbers nums;
- int length;
- cout << "Enter the size of the array: ";
- cin >> length;
- nums = new int[length];
- assign(nums, length);
- print(nums, length);
- return 0;
- }
- void assign(int arg[], int &argl)
- {
- for (int i = 0; i < argl; i++)
- {
- cout << "myArray[" << i << "] = ";
- cin >> arg[i];
- }
- }
- void print(int arg[], int &argl)
- {
- cout << "myArray = {";
- for ( int i = 0; i < argl - 1; i++)
- {
- cout << arg[i] << ", ";
- }
- cout << arg[argl-1] << "}" << endl;
- }
Add Comment
Please, Sign In to add comment