>> DAVID J. MALAN: Let's take things one step further, now.
Suppose that I don't just want to print all of my program's
command line arguments.
But I, instead, want to print all of the individual characters in each of
my command line arguments, one per line, so that upon running this
program, I simply see a stream of characters on the screen that
collectively are from my sequence of command line arguments.
>> Well, how can I do this?
I can keep intact my loop from before whereby I iterative from i up until
ARGC in order to integrate over the command line arguments themselves.
But now, within each iteration of that loop, I need to now iterate over each
of the characters or chars in a specific string.
So to do that, I need one more loop.
>> Let's add that.
for int, let's call it j, equals 0.
Now I'm going to need to integrate up until the length of the
current string in ARGV.
So let me give myself another local variable, we'll call it n, and set
that equal to the string length of the current argument, which is going to be
found in ARGV bracket i semicolon.
>> Let me now iterate from j up until n followed by an
increment on each iteration.
Let's now print the individual characters on the screen.
Printf %c this time followed by a new line, close quote, comma, and now I
need the j-th character in the i-th argument.
>> So to get at that, I can simply specify ARV bracket i to
get the i-th argument.
And then I can dive in one level deeper and do a secondary index of
bracket j, close parenthesis, semicolon, Save.
And let's now compile and run this program.
>> Make ARGV2--
not quite what I was expecting.
Let's scroll up to the first of these error messages.
And in red here, we see error, implicitly declaring library function
strlen with type--
oh, wait a minute.
This is the first time I've used strlen, and I didn't anticipate
wanting it at first, so I didn't include the header file that declares
a string length function.
>> So at the top of my file, recall, I have CS50.h.
I have standard io.h.
But it turns out, and I know this from reading the documentation, that I need
a third header file if I, indeed, want to use the strlen function.
That function is declared in string.h.
>> Let's resave the file, compile, and run.
And this time, we don't just see each of the arguments.
We instead see each of the arguments one character at a time.