Hello, and welcome. I'd like to go through another challenge for you, mainly has
to do with string functions, getting you familiar with str length and str compare
which are two of the most common
functions available. Also, I think string copy you're going to use for these.
So I want you to write a challenge that's going to
reverse the string and also a challenge
for using str compare.
So write a program that displays a string in reverse order.
You should read input from the keyboard.
And you need to use the str length string function.
Because you need to find the size of the string.
Once you have the size of the string, you can then start reversing
characters.
I'd also like you to write a program that sorts the strings of an array using a bubble sort.
You'll need to use str compare and str copy functions
to get this to work.
If you don't know what a bubble sort is you're going to have to look it up or do some research.
It's a really easy sorting algorithm for
anything, integers strings, whatever, in this case strings.
Here's what it will look like the program if you run it.
You'll ask the user to input a number of strings, they'll say three
they can input the string
three times.
So they say 0, 1 or 2, so you could have a loop here
with scanf. The expected output would be
1 2 0,
o t z.
And that's all the information I'm going to give you, pretty basic.
You're going to need to understand the arguments and parameters
that go to the str compare, the str copy and
the str length and what they return. And you don't really have to understand much about pointers for this,
really just the basics. These are two
pretty straight assignments.
One assignment with really you could even have multiple functions
or create multiple programs, it's up to you.
Good luck. And I'll provide a solution for this in the next lecture. Thank you.