Last time, we learned how to search a string for a specific character, and how to handle both finding the character and not finding the character. This time, we'll learn how to get string input from the user. I've already included the #include <string.h> because I know I'm going to want that. And I've also included comments about what we're going to do. So we're going to read in data from the user, and then we'll print out that data. That means that I need to declare a variable that will hold that data. This will be a string, an array of char, and I'm going to declare it as such. And as I mentioned before, when I said that when we look for the length of a string, we might have had extra spaces in our array of characters to support having user input, this is that time. So I'll say 100 characters. That's going to be more than enough, I'm sure. To read in the data from the user, we'll printf, and I'll say, we'll actually have them enter two comma separated values. So I'll say Enter x and y, and I'll give them a little more information in the prompt. I will say no spaces, comma-separated. And I'll actually say no spaces, comma-separated, and hopefully this prompt will be sufficient for them to understand what they're supposed to do. Before we actually see how to read in the data from the user, let's go ahead and print it out, even though we didn't initialize it by reading it from the user, we've declared the variable, so we can print it out, but we haven't actually filled it in with good data. So, let's see what happens. Printf as always. I'll say data input, and, of course, I'll use %s for string, in the data. Let's see what happens when we run. Okay, so there you go. That's a great 100 characters of strange symbols and so on. We should initialize our array of characters. We don't really know how to do that. Up to this point, we've been using scanf to actually read an input from the user, but let's look at a different way that we can use to actually read in the data. In the C standard library, one of the .h files is standard IO, so core input and output functions, that seems like what we're going to want, so I click on it, and we read this documentation. And you can see that here, under Unformatted Input and Output, there's something called Get S. And it reads a byte string from standard in, which is the keyboard, until a new line or end of file is encountered, and that feels like it's just what we want. However, when you read that something was deprecated, deprecated means that it really ought not be used anymore, and that was in C99. And in fact, the function was removed from C11. So that's not what we want, even though it seemed like what we wanted, and it would have been 20 years ago, but it's not now. We will use fgets instead. Now this says it reads a byte line from a file stream, but really, we'll learn about file streams when we talk about file input and output, but it's really just a stream of input or output. It's a file stream because it could be input from a file, if we were reading from a file, but it turns out that we can use standard in keyboard input as our file stream. So let's look at fgets. And it turns out that we will pass in three different arguments. We'll pass in data. We'll pass in the size of data. And we will pass in the name of a stream. And this will, in fact, be standard N. As we saw from the documentation, use fgets, and we're reading data, and we're protecting against trying to read more than we allowed space for. And finally, we want this to come from standard in, which is the keyboard. Now we'll run it. And now, we'll actually enter data like 3, 5. And as you can see, we read in that data. And this is a null-terminated string, fgets returns a null-terminated string for us. So the user didn't have to do anything special to get that slash zero at the end of the string, fgets simply returns a null-terminated string for us, that's all we have to do to actually read in the data. Now, of course, if the user has entered data, especially numeric data, like I've used in the example here, then we're probably going to want to convert that to actual numbers that we can use, but that's coming in a later lecture. To recap, in this lecture, we learned how to get string input from the user.