fork download
  1. #include <stdio.h>
  2. void swap(int arr[]){
  3. int temp= arr[0];
  4. arr[0]= arr[1];
  5. arr[1]=temp;
  6. return;
  7. }
  8. int main(void) {
  9. int arr[2]={10,5};
  10. printf(" Values before swapping:%d %d\n",arr[0],arr[1]);
  11. swap(arr);
  12. printf("Values after swapping are:%d %d",arr[0],arr[1]);
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
 Values before swapping:10 5
Values after swapping are:5 10