Advertisement
andruhovski

prog0109-demo_a

Sep 10th, 2014
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. // ConsoleApplication24.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. void print_mas(int *arr, int len)
  6. {
  7. for (int i=0;i<len;i++)
  8.         printf("%4d",arr[i]);
  9.     putchar('\n');
  10.     return;
  11. }
  12.  
  13. int _tmain(int argc, _TCHAR* argv[])
  14. {
  15.     int a[8]={10,3,5,6,20,44,66,8};
  16.     int x=10,i;
  17.     int l=sizeof(a)/sizeof(int);
  18.     bool isFound=false;
  19.     print_mas(a,l);
  20.     int *pos_l=a, *pos_r=(a+l-1);
  21.     do
  22.     {
  23.         int z=*pos_l;
  24.         *pos_l=*pos_r;
  25.         *pos_r=z;
  26.     } while (pos_l++<pos_r--);
  27.     print_mas(a,l);
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement