>> DAVID J. MALAN: So I'm still pretty underwhelmed by this program.
All I've done is go from saying hello world to hello David.
But there's still no dynamism in this program.
There's no user input.
There's just hard coded output.
>> Well, we can do better than this.
Let's go back into the inside of my main function.
And this time, rather than hard code David as my name, let me replace this
line with, first, an instruction to the user.
Printf state your name.
So we've now informed the user what we expect of him or her, to state their
name, but we now need to actually get the user's name.
>> Well, as before, I can store the user's name, ultimately, in a variable
of type string.
And I'm going to call it, as before, name.
But I now need to assign, as with the assignment operator, some value to
that variable.
But this time, I don't want to hard code it like I did before with quote,
unquote David.
Rather, I want to dynamically get the users input from their keyboard and
then store that value inside of this variable called name.
>> Well, to do this, I can invoke a function, a function that happens to
be called get string.
But this function, much like string, itself, does not actually come with C.
Rather, the CS50 staff has declared, in a file called CS50.h, a function
called Get String whose purpose in life is to allow the user to type his
or her name at the keyboard, and then this function, get string, returns
that value, so to speak, from the right hand side of this expression
into the left hand side of this expression.
>> Let's save the file and compile this program.
Make hello-2, Enter.
We're back at our blinking prompt.
Now I'm going to go ahead and run ./hello-2.
I'm indeed prompted to state my name, and I'll do just that, D-A-V-I-D.
Enter, and there we have a program that, again, prints hello David.
>> But this time I claim that David is dynamically outputted to the screen,
based on what I, myself, just typed.
So let's test that hypothesis and re-run this program with hello-2.
Let's state my name, this time, as Alice.
And indeed, I'm greeted with hello Alice or any other
name, for that matter.