Question: #include #include void bubbleSort ( char arr [ ] [ 5 0 ] , int n ) { for ( int i = 0 ;

#include
#include
void bubbleSort(char arr[][50], int n){
for (int i =0; i < n -1; i++){
for (int j =0; j < n - i -1; j++){
if (strcmp(arr[j], arr[j +1])>0){
// Swap arr[j] and arr[j +1]
char temp[50];
strcpy(temp, arr[j]);
strcpy(arr[j], arr[j +1]);
strcpy(arr[j +1], temp);
}
}
}
}
int main(){
int n;
printf("Enter the number of students: ");
scanf("%d", &n);
char studentNames[n][50];
// Input student names
for (int i =0; i < n; i++){
printf("Enter name of student %d: ", i +1);
scanf("%s", studentNames[i]);
}
// Sort the array of student names
bubbleSort(studentNames, n);
// Display the sorted list
printf("
Sorted list of students:
");
for (int i =0; i < n; i++){
printf("%s
", studentNames[i]);
}
return 0;
} draw A flowchart for this c code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!