I\'m trying to bubble sort a character array in alphabetic order. My code is as follows:
#define CLASS_SIZE 10
#include
void bubbleSortAWrit
Bubble sort
Console: Input: "face321" OutPut: "123acef"
#include
int main(){
char c[80] = "0";
char temp = '0';
int offSet = 0;
int i = 0;
int j =0;
int count =0;
printf("Enter first string: ");
gets(c);
while (*(c + offSet) != '\0') {
count++;
offSet++;
}
for (i = 0; i < count; i++) {
for (j = 0; j < count - 1; j++) {
if (c[j]>c[j + 1]) {
temp = c[j];
c[j] = c[j + 1];
c[j + 1] = temp;
}
}
}
puts(c);
return 0;
}