Question
Write a C (NOT C++) program that will read in one character per line until you hit a 0 (zero as a character), store those
Write a C (NOT C++) program that will read in one character per line until you hit a 0 (zero as a character), store those characters in an array, sort that array (from largest to smallest) and print out each character with a space between them (no newlines).
Notes:The file that will have the characters in it is alphabet.txt. Remember how to do file redirection: myprog < alphabet.txt The file will have one character per line so you will need to also read in the newline after you read in each character. You must: Use an array to store the characters Read the characters in from stdin Make your output print as: z y x a There will only be 1 newline and that is after the last character printed.
alphabet.txt
f k s j p a v r t u h m g e b y n z w l i x q c d 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started