text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
and actually run it
before your own command. | 43.11 | 2.22 |
So that if you don't
understand some error | 45.33 | 1.75 |
message from a program you're
compiling or a command you're running, | 47.08 | 2.833 |
you can actually see some
helpful output from CS50 staff. | 49.913 | 3.297 |
eprintf, which, by contrast, is
something you can put into your code, | 53.21 | 4.36 |
like printf, and print
a message to yourself. | 57.57 | 2.23 |
And nicely enough, it's going to
actually include the line number | 59.8 | 2.758 |
and the file name from which it came. | 62.558 | 1.541 |
So you can identify where
some output is coming. | 64.099 | 2.171 |
And then lastly, debug 50 which is the
most sophisticated of these programs. | 66.27 | 3.75 |
And debug 50 when you run
it at the command line, | 70.02 | 2.7 |
followed by the name of your
program in the usual way, | 72.72 | 2.417 |
it's actually going to open
up what's called a debugger. | 75.137 | 2.333 |
A graphical user interface
that CS50 staff put together | 77.47 | 3.517 |
that will actually let you
step through your code, | 80.987 | 2.083 |
see variables, and generally
understand it better. | 83.07 | 3.52 |
So we also looked at this
in the context of Ovaltine | 86.59 | 2.91 |
in particular, and Little Ralphy. | 89.5 | 1.39 |
And we looked at cryptography,
the art of concealing information. | 90.89 | 4.28 |
And indeed, among the
challenges in CS50, | 95.17 | 2.31 |
ultimately if you choose
to accept them, are | 97.48 | 2.08 |
things like implementing
Caesar cipher and Vigenere | 99.56 | 2.88 |
cipher, cracking passwords. | 102.44 | 2.04 |
So indeed, those problems lie ahead
and draw inspiration from this domain. | 104.48 | 4.1 |
And then, we focused more
technically on what a string is. | 108.58 | 3.31 |
So Zamyla, a name we keep taking for
granted, that a computer can express. | 111.89 | 3.58 |
Z-A-M-Y-L-A, as a string
or a phrase in a program. | 115.47 | 5.16 |
But it turns out that
underneath the hood, | 120.63 | 2.83 |
strings are a little more mundane. | 123.46 | 2 |
They really are just
this grid of information. | 125.46 | 2.82 |
And we might draw Zamyla's
characters boxed in like this. | 128.28 | 2.534 |
But if you think of what's
inside of your computer itself, | 130.814 | 2.416 |
you have a whole bunch
of memory, or RAM. | 133.23 | 2.24 |
And inside of that RAM,
you have Z-A-M-Y-L-A, | 135.47 | 3.95 |
but then this special character. | 139.42 | 1.57 |
What is this /0 used for. | 140.99 | 2.97 |
Why is there this seemingly strange
character at the end of Zamyla's name? | 143.96 | 5.1 |
Anyone? | 149.06 | 1.1 |
Yeah. | 150.16 | 0.944 |
AUDIENCE: [INAUDIBLE]. | 151.104 | 0.916 |
SPEAKER 1: Yeah, to denote
the end of the string. | 152.02 | 1.75 |
Because after all, if we were to
have someone else's name here, | 153.77 | 2.624 |
if the next string I got
is Maria, for instance. | 156.394 | 2.846 |
M-A-R-I-A, we need to be able
to know where Zamyla's name ends | 159.24 | 5.1 |
and Maria's name starts in memory. | 164.34 | 1.59 |
Because at the end of the day,
C, and programming in particular, | 165.93 | 3.42 |
isn't really all that sophisticated. | 169.35 | 1.5 |
At the end of the day, the only
place you have to store things | 170.85 | 2.583 |
is your computer's memory or RAM. | 173.433 | 1.537 |
And each of these boxes represents a
byte of memory inside of your computer. | 174.97 | 4.27 |
And so if all this is-- so
far as the computer cares-- | 179.24 | 2.96 |
is a sequence of six
alphabetical letters, | 182.2 | 2.44 |
the computer needs to be told
or given a hint as with this /0, | 184.64 | 4.46 |
which just represents 8 zero bits, as to
where Zamyla's name ends and something | 189.1 | 4.22 |
else begins. | 193.32 | 1.64 |
And we use this as an opportunity
to introduce ultimately | 194.96 | 2.6 |
command line arguments. | 197.56 | 1.22 |
So in particular, we've been
writing programs thus far | 198.78 | 2.25 |
with just int main void. | 201.03 | 1.12 |
And void, we realized, signifies that
a program takes no command line inputs. | 202.15 | 5.21 |
It can still call functions, like get
string and get int and get [? flow. ?] | 207.36 | 3.74 |
But when you run the program, you can't
put any additional words at the prompt | 211.1 | 3.57 |
after it if you've declared
main as taking void as input. | 214.67 | 3.64 |
Nothing as input. | 218.31 | 1.34 |
But we introduced instead
this, int main int arg | 219.65 | 3.01 |
c string arg v open bracket
close bracket, which | 222.66 | 3 |
means main can alternatively take two
inputs from the so-called command line | 225.66 | 4.294 |
when you run it. | 229.954 | 0.666 |
It can take arg c and arg
v. And what was arg c? | 230.62 | 4.91 |
What was arg c? | 235.53 | 2.86 |
Arg c. | 238.39 | 1.57 |
Yeah, argument. | 239.96 | 1 |
Yeah. | 240.96 | 0.94 |
AUDIENCE: [INAUDIBLE]. | 241.9 | 0.94 |
SPEAKER 1: Yeah, the number
of command line arguments. | 242.84 | 2.25 |
Arg c for argument count. | 245.09 | 1.55 |
So how many words did
you type at the prompt? | 246.64 | 2.19 |
And arg v means argument
vector, which is | 248.83 | 2.69 |
another way of saying it's an
array, a contiguous block of memory | 251.52 | 5.58 |
inside of which are all
of the words themselves | 257.1 | 2.32 |
that you might have typed at the prompt. | 259.42 | 1.8 |
So this time, we're
going to build on that. | 261.22 | 1.88 |
We're going to focus
today mostly on ideas. | 263.1 | 3.1 |
Mostly on algorithms. | 266.2 | 1.08 |
Mostly on problem-solving and less
on the lower-level implementation | 267.28 | 2.86 |
details of code. | 270.14 | 0.85 |
Though, we'll look at
a couple of examples. | 270.99 | 1.81 |
So this more generally is
what's called an array. | 272.8 | 2.64 |
If you think of your computer's
memory as just a block of memory, | 275.44 | 3.43 |
block of bytes. | 278.87 | 1.17 |
And maybe it's byte 0, then byte 1. | 280.04 | 1.98 |
Then, byte 2, just because you
can number them, certainly. | 282.02 | 2.64 |
If you think of them that way, this
is kind of an arbitrary generic data | 284.66 | 5.63 |
structure, if you will. | 290.29 | 1.24 |
A generic way of just storing
things underneath the hood. | 291.53 | 2.93 |
Now, what do I mean by that? | 294.46 | 1.42 |
And why is this useful? | 295.88 | 1.51 |
Well, consider something like this. | 297.39 | 2.92 |
Consider having 8 doors,
behind which are some numbers. | 300.31 | 3.56 |
And the goal at hand
is to solve a problem. | 303.87 | 2.07 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.