Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could you rewrite the C program and tell me where I have gone wrong? Write a program to arrange a set of fruit names in

image text in transcribedimage text in transcribedCould you rewrite the C program and tell me where I have gone wrong?

Write a program to arrange a set of fruit names in lexicographically sorted order. Input format The first line of the input consists of the value of n. Next n input is the fruit names. Output format The output prints the fruit names in lexicographically sorted order. Sample testcases Input 1 Output 1 8 mango banana apple apple banana coconut grapes mango orange papaya watermelon orange grapes coconut watermelon papaya 2 #include 3 #include 4 int main() 5-{ 6 char name[20][10], t_name[15][10], temp[10]; 7 int i,j,n; 8 scanf("%d ",&n); 9 for(i=0;i0) 19 { 20 strcpy(temp, name[i]); 21 strcpy(name[i], name[j]); 22 strcpy(name[j], temp); 23 } 24 } 25 } 26 for(i=0;i<><>

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

Students also viewed these Databases questions