bubble sort in c program example. In this we can execute the bubble sort program in c with sample examples for beginners.

## Bubble Sort Definition in C

In computer science, binary search is a search strategy that locates a target value within a sorted array. It is also known as half-interval search, logarithmic search, or binary chop.

In a binary search, the target value is compared to the array’s middle element. In a sorted array, Binary Search is a search algorithm for locating a specific element (target value).

The array should be sorted before performing a binary search. Binary search is also known as logarithmic search, binary chop, and half interval search.

## Array Definition in C

A collection of data components of the same type stored in contiguous memory regions is referred to as an array. In the C programming language, arrays are a derived data type that can hold primitive data types such as int, char, double, float, and so on.

An array is a collection of elements of the same kind that are stored in contiguous memory locations and may be accessed separately using a unique identifier’s index.

The syntax for declaring an array is quite straightforward. The syntax is the same as for a regular variable declaration, with the exception that the variable name must be preceded by subscripts to define the size of each array dimension.

## Bubble Sort in C Program Example

```
#include<stdio.h>
int main()
{
int array[100], n, c, d, swap;
printf("Enter Number of Elements\n");
scanf("%d", &n);
printf("Enter %d Numbers\n", n);
for (c = 0; c < n; c++)
scanf("%d", &array[c]);
for (c = 0 ; c < n - 1; c++)
{
for (d = 0 ; d < n - c - 1; d++)
{
if (array[d] > array[d+1])
{
swap = array[d];
array[d] = array[d+1];
array[d+1] = swap;
}
}
}
printf("Ascending Order\n");
for (c = 0; c < n; c++)
printf("%d\n", array[c]);
return 0;
}
```

Output:

4

Enter 4 Numbers

67

89

67

34

Ascending Order

34

67

67

89

Linear Search in C Program Using Array

Insertion Sort Program in C Using Array

Bubble Sort Program in C Using Function

Bubble Sort in C Program Example

Binary Search in C Program Using Function

Prime or Not in C Using Function

LCM of Two Numbers in C Using For Loop

LCM of Two Numbers in C Using Recursion