C program for Bubble Sort

C program for Bubble Sort

Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in the wrong order. We write a simple c program for bubble sort by keeping the logic intact. 

	Bubble Sort Program
	Author 			: 		Krishna Teja G S
	Repository		:		github.com/packetprep/coding-questions
	Website			: 		packetprep.com

void swap(int*,int*);
void BubbleSort(int *,int);
int main(){

	int arr[] = {100, 5, 201, 13, 5, -8,12,-8,3,-8}; 
	int i;
	int n = sizeof(arr)/sizeof(int); 

	printf("Elements: \n");

	for(i=0;i < n ;i++){

	//logic to sorting

	printf("Sorted Elements: \n");

	for(i=0;i  arr[j+1]) 
              swap(&arr[j], &arr[j+1]); 


void swap(int *a, int *b){
	int temp;

	temp = *a;
	*a =  *b;
	*b = temp;
wipro free mock test
Wipro National Qualifier Test is just a few days away. To help you crack the exam we are sharing a mock test specially designed for Wipro based on all the previous papers.