Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define N 100
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- void main()
- {
- while(1)
- {
- int b;
- int *p, *q;
- printf("Unesite duzinu niza n: "); int n; scanf("%d",&n);
- if (n<=0 || n>N) break;
- printf("Unesite elemente niza: "); int a[N];
- for(p=a;p<a+n;scanf("%d", p++));
- for(p=a, q=a+n-1; p<q; p++,q--)
- {
- b=*p; *p=*q; *q=b;
- }
- printf("\n\nRezultujuci niz izgleda ovako: "); for(p=a;p<a+n;printf(" %d",*p++));
- printf("\n\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment