How to right the c program.? Using the arrange() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to right the c program.? Using the arrange()

Output 3latter word xyz

26th Feb 2022, 2:15 AM
maung than
11 Answers
+ 1
So you need to arrange the letters in descending order by writing your own arrange() function?
26th Feb 2022, 2:42 AM
William Owens
William Owens - avatar
+ 1
Lets start with getting the users input. How will you get the user input and store it in the array? Lets say char three_letters[4];
26th Feb 2022, 2:44 AM
William Owens
William Owens - avatar
+ 1
In your terminal window type "man scanf" or "man fgets" and show me how you will store the user input into char three_letters[4];
26th Feb 2022, 2:47 AM
William Owens
William Owens - avatar
+ 1
so: char three_letters[4]; puts("Please enter three letters:"); scanf( What goes in here );
26th Feb 2022, 2:50 AM
William Owens
William Owens - avatar
+ 1
The problem with scanf is that its not going to protect from segment fault. I would use fgets for this project. char three_letters[4]; puts("Please enter three letters:"); fgets( What goes in here? );
26th Feb 2022, 2:52 AM
William Owens
William Owens - avatar
+ 1
Yes bro i try nw. Thks
26th Feb 2022, 2:53 AM
maung than
+ 1
After you get the users input you will have to build your arrange() function this can be done in a few ways: void arrange(char *word){ Do Stuff; } or char *arrange(const char *word){ Do Stuff;} Show me some of your work, and well keep building this together.
26th Feb 2022, 2:58 AM
William Owens
William Owens - avatar
0
Write a program to ask the user to enter three(3) letter. Store the data in char arry a[]. Use arrange to sort the letter in descending order,then print the result to the terminal screen. Example enter 3 letter: xyz. Zyx
26th Feb 2022, 2:38 AM
maung than
0
Printf
26th Feb 2022, 2:42 AM
maung than
0
Scanf
26th Feb 2022, 2:48 AM
maung than
- 1
This is my exam Question. How to do don't know? Pls help us thanks.
26th Feb 2022, 2:39 AM
maung than