fork download
  1. #include <stdio.h>
  2.  
  3. void F(int* p, int n) {
  4. int i;
  5. for (i = 0; i < n - 1; i = i + 1) {
  6. int tmp = *(p + i + 1);
  7. *(p + i + 1) = *(p + i);
  8. *(p + i) = tmp;
  9. }
  10. }
  11.  
  12. int main(void) {
  13. // your code goes here
  14. int a[5] = { 7,3,6,9,5 };
  15. F(a, 5);
  16. for(int i=0;i<=4;i++){
  17. printf("%d\n", a[i]);
  18. }
  19. //system("pause");
  20.  
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 4408KB
stdin
Standard input is empty
stdout
3
6
9
5
7