rite a function that when invoked as bubble_string(s) causes the characters in the string s to be bubble-sorted. If s contains the string "xylophone", then the following statement should cause ehlnoopxy to be printed.
The errors I get are: 10.4.c: In function `main':
10.4.c:8: error: invalid use of void expression
10.4.c: In function `bubble_string':
10.4.c:17: error: syntax error before ')' token
Any ideas on how to fix this?
Code:
#include <stdio.h>
void swap (char*, char*);
void bubble_string(char s[]);
int main(void)
{
char *s= "xylophone";
printf("%s", bubble_string(s));
return 0;
}
void bubble_string(char s[])
{
char i, j, n;
n = strlen(s);
for(i = 0)
for(j = n - 1)
if(s[j-1] > s[j])
swap(&s[j-1], &s[j]);
}