Code:
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
int* bubbleSort(int arr[], int n){
int temp, i = 0, j = 0;
int *s_arr = (int*)malloc(n * sizeof(int));
// Copy arr to s_arr
for(i=0; i<n; i++)
s_arr[i] = arr[i];
// Actual sorting using array notations
// Comment this when implementing pointer version.
for (i=0;i<n-1;i++){
for(j=0;j<n-1;j++){
if(s_arr[j] > s_arr[j+1]){
temp = s_arr[j+1];
s_arr[j+1] = s_arr[j];
s_arr[j] = temp;
}
}
}
// Actually sorting using pointer notations. i.e. you cannot use”[]”!
// Your code goes here…
return s_arr;
}
void printArray(int arr[], int n){
int i = 0;
printf(“[“);
for(i=0; i<n; i++)
printf(“%d “, arr[i]);
printf(“] “);
}
int bSearch(int
PayPal Gateway not configured
PayPal Gateway not configured