chillurbrain

Task7_7_2

Dec 23rd, 2015
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <conio.h>
  4.  
  5. using namespace std;
  6.  
  7. void printArray(char** ptrName, int* ptrAge)
  8. {
  9.     for(int i = 0; i < 3; i++)
  10.     {
  11.         cout << ptrAge[i] << " - " << *(ptrName + i) << endl;
  12.     }
  13. }
  14.  
  15. int main()
  16. {
  17.     char* names[3] = {"Nikita", "Vlad", "Ivan"};
  18.     int ages[3] = {19, 18, 20};
  19.     char** ptrName = &names[0];
  20.     int* ptrAge = &ages[0];
  21.     printArray(ptrName, ptrAge);
  22.     _getch();
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment