cara mendapatkan samsung s4 line
>> jason hirschhorn: welcometo a5, everyone. we have an exciting week ahead of us,mostly because there are so many new faces in this room. it's wonderful. a lot of you are here by accident,which is even better. so hopefully you'll keep joining us. >> this week we're going to spendthe bulk of section preparing for the quiz. so per our agenda, we're going to talka bit about resources for the class,
but also for the quiz, and then, again,spend the bulk of class talking about questions. once we're done answering yourquestions, or if your questions naturally lead us to some coding, ihave sample problems from midterms past that we will code live in sectiontogether that also bring up some other good topics to cover. >> so first, as we've gone through for thepast couple of weeks to remind you guys, there are a ton of resourcesavailable for this course. many of them will be incredibly helpfulto you as you continue to
study for quiz 0, becauseit's tuesday afternoon. so all of you have beenstudying for a bit. >> there are lecture notes and sourcecode that you should definitely check out. watch the shorts. check out study.cs50.net. and then, listed below, a numberof other resources. >> again, quiz 0 is tomorrowat 1 o'clock. if you haven't done so already, checkout the about quiz 0 document on the
course's homepage to figure outwhere you're taking the quiz. the quiz starts at 1:10 andends 70 minutes later. so if you show up after 1:10, you'regoing to get that many fewer minutes than 70 to take the quiz. so make sure you're there on time. if you're an extension student or havesome other testing considerations, it might not be at 1 o'clock tomorrow. but again, check the about quiz 0document to make sure you know when you're taking the quiz.
i wrote 75 minutes up here. i think that's right, not 70. >> it covers all the material from a week 0to last week's lecture on wednesday. and again, for this quiz, per thatdocument, you get one two-sided and 8 1/2 by 11 sheet of paper that you getto use as notes during the quiz. many people, if not most people, havefound that the single most helpful way to study for the quiz is tomake a study sheet, a one-sider, of their own. so look at past ones ifyou've seen past ones.
reach out to friends to see whatthey're putting on theirs. >> but hands-down, the best way you canstudy is to go through everything and whittle it down to what should or shouldnot belong on that sheet of paper, because that's just a reallyhelpful way for you to make sure you're going through everything andhave some familiarity with it. most people, we find, even though theyhave the sheet of paper sitting right next to them on the quiz, don't turnto it, because, again, that very process of going through the informationhas helped them learn it. >> does anybody have any questionsabout quiz 0?
has everybody-- i'm not going to do a show of hands. never mind. i was going to ask whostarted studying. but i don't want to make youall not raise your hands. so like i said-- yes, avi, go ahead. >> avi: what would be a useful thingto put on the one-pager? >> student: that's up to you. >> jason hirschhorn: you getto use your judgment.
useful things to put on the one-pager,if you are confused about the big o runtime of different types of searchesand sorts, put that on there in a handy dandy chart. that way, if you're asked that on thequiz, you don't need to try and figure it out or reason through the runtime. you can just copy it down. if you look at quizzes past, a lot oftimes, there's running time questions. so that would be an example of a goodthing to put on your one-pager. >> other good things to put on, if you'reconfused about how to declare a
function or what the different parts ofthe function declaration are, write that on there, a generic versionand then maybe an example. if you're confused about pointers,a diagram of how pointers work is probably really helpful. if you're confused about recursion, asample recursive function on there could also prove to be really helpful. does that give you some ideas? >> avi: you need to understand theentire compiling process, like how that all works?
>> jason hirschhorn: everythingthat has been covered could show up on the quiz. questions-- but again, some things will beweighted heavily than others. some things have come up againand again in class, in lecture, and section. other things have notcome up that often. >> we've talked a lot about #include and-l something and what those mean in the compilation process.
we've talked a lot about gdb, cling,those different flags that we use when we compile something, and whatmake15, for example, really means and really does. we have not talk as much aboutevery single step in we've still talked about it. so it's still something that youshould be familiar with. but again, we're not going to be-- things that come up more often in classare more likely to come up more often and be more heavilyweighted on the quiz.
>> cool. any other questions about quiz 0? >> ok, so i put a list oftopics on the board. i went through the syllabus. i went through the review section fromlast night and those slides to come up with a non-exhaustive list of topicsthat we have covered so far in cs50 and things that mightappear on the quiz. so i'm not going to go throughevery single one of these. that would take much moretime than we have now.
but i put this up here to hopefully jogyour memory as to things that may or may not be as familiar with you. >> and i'd love to spend the bulk ofsection answering your questions about these topics, topics thataren't covered here. we can write pseudo code. we can write real codeto ensure that you-- i can answer your question and helpeverybody fundamentally understand a lot of these topics so you'll feelprepared and comfortable going into the quiz tomorrow.
so read over the list. you hopefully have come to sectionwith some questions as well. when you're ready, raise your handand we will get started. >> keep in mind, the questions you have,there are no stupid questions. we've heard that a lot. and the questions you have, i am willingto bet, many other people both sitting here and watchingonline have as well. so you can only help peopleby asking questions. marcus.
>> marcus: between the stack and theheap, is there a pre-allocated percentage of memory that's defined asthis is for the stack or for the heap? or how does that work, exactly? >> jason hirschhorn: great question. i'm going to back trace a little bit. does everybody-- please be honest here. i know i'm asking you to raise yourhand in front of your peers. but are there people who feeluncomfortable with the stack and heap
and would like to go over thatand what those mean? raise your hand if-- ok. thank you. so we're going to go over the stack andthe heap really quickly and then move into answering your question. >> so if we draw out a box to representmemory on your computer, what are some things that go in this box? main.
a main function. where does main go? >> student: [inaudible]. >> jason hirschhorn: so we'llput main down here. what else goes in this box? >> student: the functions that you call. >> jason hirschhorn: the functionsthat we call. and where do they go? >> student: in the stack.
>> jason hirschhorn: theygo in the stack. so we're going to call thisthing down here the stack. and up top, we have the heap. so memory is not a box just like this. but it is actually pretty similar. it's going to be a lot of boxes overand over, depending on how big your computer is or how big your memory is. >> at the quote-unquote "bottom"is the stack. and there are multiple thingsthat go on the stack.
and those depend on the functionsyou have in your code. you always have one function in yourcode called main, so there's always a section down here in thestack devoted to main. >> these sections in the stackare called stack frames. when you call another function, say maincalls a binary search function, we put another frame on the stack. more specifically, we are going todonate a chunk of memory on our computer to store binary search's localvariables and to run the binary search code.
>> so we call binary search. in this chunk of memory, we're goingto store its local variables. we're going to store its printf calls. whatever happens, that function isgoing to be stored right there. binary search is going to execute. it is going to complete execution. what is the word in c that signifiesthat a function should complete its execution? >> student: return.
>> jason hirschhorn: return. so whenever you see a return statement,the function ends when it hits that. so binary search will hit its return. this part of memory will essentiallybe freed up. and main will go back to execution. so main will pause wherever was, callbinary search, get some return value, and continue execution. this stack frame will go away.
>> if we call a recursive function, whichis a function that calls itself over and over, we might get-- say wedid binary search recursively. we might get binary search version one,binary search two, binary search three, binary search four,binary search five. and then this final binary search fivewill hit the base case, and the stack frames will go back and keep closinguntil we get back to main. we can go over recursion in a bit. but all this is to say, if you'recalling multiple functions at a time, there'll be multiple stackframes on the stack.
>> the heap, on the other hand, uphere, is not for functions, not for local variables. it's for dynamically allocatedvariables. so these are variables that can beinitialized in either main or a function that main calls. anywhere in your code, theycan be initialized. and to initialize a dynamicallyallocated variable. what function in c do we use? >> student: malloc.
>> jason hirschhorn: malloc. you call malloc. you get a space of memory. and that space of memoryis on the heap. and that space of memory staysthere until you call free. >> so dynamically allocated variables inheap will exist for as long as you want them to exist, and they won'tgo away until you explicitly tell them to go away. you can create them in one function.
that function's stackframe will go away. but that variable will still existin the heap until it is freed, potentially by the function that calledbinary search or whatever. >> so those heap variables stay therefor as long as you want them to stay there. and they get put here. and then the next one gets put there. they keep getting filled in, and theystay there until you call free. >> and essentially, the heap and the stack,getting to marcus's question,
grow towards each other. and if they run into one another, you'veused up all the memory in your computer, and your program will quitbecause you don't have any more memory left to use. in between them, there arepotentially other things. but for the scope of this course, youdon't need to worry about that. >> so that was the answerto your question. don't worry about it. but that was the long answer.
all you need to know is theheap and the stack will-- one starts at the bottom. the stack does. the heap's up there. they will grow closer to one another. >> and if they touch, that's a problem. you ran out of memory. but also, in addition to knowing wherethey are, what is stored in both the stack and heap.
curtis. >> curtis: when they collide,is that a stack overflow? >> jason hirschhorn: when they collide,that's not a stack overflow. a stack overflow is a different areathat we can go over if you want to. ok, we'll come back to that in a bit. >> student: what's the word calledwhen they hit each other, the stack and the heap? >> jason hirschhorn: for now,don't worry about. just know--
i will answer that questionafter class. if they run into each other, you ran outof memory, because there's no more space there. >> student: sorry, what's a seg fault? >> jason hirschhorn: a segmentfault can be called for-- it depends why the seg fault's called. sometimes, your stack overflow, it'llsay seg fault as the error. >> student: what about dereferencinga null variable? is that a seg fault?
>> jason hirschhorn: dereferencinga null pointer-- ok, so if you have a pointer that youset equal to null, pointers, recall, store memory addressesas their values. and a null pointer is essentiallystoring 0, the 0-th address in that variable. so 0x, 0, 0, 0, 0, et cetera. that 0-th address in memory that's notin our picture, that's up there somewhere, that's reservedfor the computer. we're not allowed to touch it.
>> so when your program's executing, ifsomething is trying to go to memory address 0, it knows thatthat is an empty value. it knows nothing should be there. so if you try and use something thereand treat something like there or trying to go to that location, you'regoing to get a seg fault or an error. does that answer your question? >> and now we'll go backto stack overflow. things in the stack, as you guys haveseen before, in-- let's draw a close up of a stack frame.
can everybody see that? so we have our stack frame. we're saving an array in as a localvariable in this function. so say our array has five spots. all five of those will be storedin that stack frame. >> if we start writing beyond thebounds of this array-- so if we start writing into,let's say that's 0. those are the five indexesof our array. if we start writing into index 5, whichwe don't have when we have an
array of size 5, we start writing intoindex 6, 7, 8, 9, we can get a stack overflow error. >> generally it's not-- you will probably get into troubleif you go over by one. but generally, you will get into themost trouble if you go over by a lot and you go so far over that you writeover the return address of that function, which is located at thebottom of the stack frame. >> because, right? you-- in the-- sorry.
not "because right." >> in the stack frame, you haveyour local variables. at the very bottom of the stackframe is the return address. that's where the functiongoes when it's over. and if you overwrite that returnaddress, then when this stack frame, when you're going through the stackframe and executing each line, you're going to go to your new return addressthat's written there instead of the actual one. and that's how we've seensome security breaches
can happen with computers. >> so stack overflow, in short, is whenyou overwrite the part in the stack you're supposed to use, the localvariable you're supposed to use, and in particular when you start overwritingimportant things like the return address. and that's where you'll get an error. or maybe even you could starteven writing into-- say binary search wasright above main. if you overwrote a lot, youcould write into main.
but generally, you get an error beforethen, because the computer knows you're doing something youshouldn't be doing. yeah. >> student: what's the differencebetween a stack overflow and a buffer overflow? >> jason hirschhorn: buffer overflowis a more generic type of what i've just described. >> student: so a stack overflow is anexample of a buffer overflow. >> jason hirschhorn: exactly.
this is an array we can think of as abuffer, a space for things to go in. this is a stack buffer overflow. we could have a heap buffer overflow. if there was a buffer, which there oftenis an array the heap, and we overwrote those bounds, then we wouldhave a heap buffer overflow. >> and beyond the scope of this course,they're detected a bit differently. the compiler has specialways of detecting each. but a buffer overflow is a more generictype of what i described, which was a stack buffer overflow.
did that answer your question? sweet. >> were there any other questions relatedto the stack or the heap? >> student: i know you have to free stringsbecause they're in the heap and you don't want to leak memory. but do you have to free global variablesand stuff like that? or are they automatically freed? >> jason hirschhorn: good question. so in cs50.h, we create this thingfor you called a string.
a string is really what? >> student: char star. >> jason hirschhorn: a char star, a pointerto a character, a pointer to an array of characters. that's what the string is. so we need to free it, becausegetstring, which we used a lot-- string name equals getstring-- that mallocs for us some memory on theheap and then returns a pointer to the first character of thatstring, a char star.
>> so ostensibly, if you have not beenwriting free on any of your strings that you've called so far, you havebeen leaking some memory. of course we haven't talked aboutit, so nobody's gotten in trouble for doing it. but going forward, yes. when you call getstring, you'remallocing some space on the heap. and if you don't call free later on thatstring, you have a memory leak. that answer your question? >> yeah
>> student: so to do that, do we usefree right before return? like, within the scope of, i guess ifwe say, like, int main, within the scope of the code that's within thosecurly braces, right before-- you know where you'dusually put return. do you put free before that? >> jason hirschhorn: so you can put freewherever you want to put free. because these are dynamically allocatedvariables, because they can live beyond the scope of a particularfunction, if you call malloc in a separate function, for example,getstring, you can call free in main.
you don't need to call itin the specific function where malloc is called. but you do need to call itbefore main returns. >> and it really depends. it depends on why you malloced thatspace in the first place. some people will callfree pretty quickly. some people won't call free untilthe end of their program. and they'll go throughand free everything. it depends on why you called malloc.
>> student: and what would you sayif you called use getstring? you'd say free what? >> jason hirschhorn: so the syntax for freeis simply free, open paren, close paren, and the name of the pointer. so if you write string name equalsgetstring, you put name in here. that's the name of the pointer. and it knows to free that memory. >> student: so when it frees that memory,the pointer still points to that place in the memory?
or is the pointer also emptied ofthe address that it points to. >> jason hirschhorn: we should try that. we should code that. let's come back when we get tocoding, and let's code that. and if you want to figure out the answerto that, you can also code that in the meantime. but that's a great question. >> student: is it possible tofree something too soon? so you still need it for your program,and you freed that memory space?
>> jason hirschhorn: yes. it is possible, if you free somethingand then you use it again, you will run into an error. but that's on you, because you freedsomething and then called it later. so that was a programmer's mistake. but yes. you could write that. >> any more questions on-- yes.
>> student: so if you are supposed to justfree it in general before the program ends, does that mean if theprogram ends and you don't free it, that memory is still allocated? >> jason hirschhorn: if your program endsand you forget to free something, then that memory was allocated throughoutthe lifetime of your program. when your program closes completely,that memory is not going to stay there forever. the computer is smart enough to knowthat when the program closes, it should get rid of all of the memory thatwas associated with that program.
>> however, there are tools you can runon a program to detect if, when the program finished, you forgotto free some memory. and for your next problem set whereyou'll be using malloc and using pointers, you will be running thisprogram on your program to see if, when main returns, you had somethings that were left unfreed. >> so they're not going to stay mallocedforever in your computer. that would be wasteful, becausevery quickly, computers would run out of memory. but if they run until the end of yourprogram and they're not freed and your
program exits, that's still a problemthat this tool will help you address. >> student: is that valgrind? >> jason hirschhorn: it'scalled valgrind. and you'll be-- >> student: but we don't have to knowthat for the quiz, though? i mean, it was talked abouta little bit in lecture. >> jason hirschhorn: so valgrindis the name of that tool. knowing what it does isenough for the quiz. but you have not used it yet on yourproblem set because we haven't had a
problem set that has explicitly dealtwith malloc or you using malloc. so you haven't used valgrind yet. but you will use it soonerrather than later. >> student: can you repeatwhat valgrind is? >> jason hirschhorn: sorry? >> student: can you repeat whatthe purpose of valgring is? >> jason hirschhorn: valgrindis the name-- like gdb helps you debug your program,valgrind helps you figure out if things have not been freedwhen your program closes.
so you'll run it on your program. and your program exits, and it'll sayyour program called malloc this many times for this many bytes, and youonly called free this many times. and so you left these many byteswithout being freed. or it'll say you've freed everything. good job. >> student: ok. and it's called valgring? >> jason hirschhorn: v-a-l-g-r-i-n-d.
>> student: a question about pointers. so say you have n starx equals something. that equals, whatever you're puttingthere, is that what's being put inside what x is pointing to,or the pointer of x? >> jason hirschhorn: can yourepeat the question? can we draw it while you say it? >> student: in the quiz, actually, theone you sent us, it was like, char star truth equals cs50 rocks, right? so does that mean that that cs50 rocksis what the truth is pointing to?
>> jason hirschhorn: so you're talkingabout a char star in a string, how that works? let's draw this over here. >> [side conversation] >> jason hirschhorn: so this variableis going to be of type char star. how big is a variableof type char star? how many bytes? >> students: four. >> jason hirschhorn: it's four bytes.
how many rights is a variableof type int star? >> jason hirschhorn: four bytes. if it's a pointer, then it is alwaysfour bytes, because pointers, their value is a memory address. and memory addresses on the cs50appliance are four bytes long. so when we call getstring, or when wesay, stringname equals, and then in double quotes put a string,we are putting-- well, that's a little different. we'll do getstring as the example.
or char star somethingequals the string. sorry, give me the examplethat you read? >> student: char star truth equals"cs50 rocks" in double quotes. >> jason hirschhorn: so this star, thiswe'll call this variable x for our generic purposes. we've created a variable called x. it's type char star. it is a pointer to a seriesof characters. so down here--
>> so this is how this wouldwork in memory. this would store a memory address. it would store the memory address ofthe first character in the array. and then when you followedthe pointer, you would get the first character. >> and if you're reading this thing likea string, your computer is smart enough to know, read this whole thinguntil it gets to a backlash 0. but if you're reading it a character ata time, so you're iterating through this string, then you will just read acharacter at a time until you get to
backslash 0. that might not answer yourquestion, though. >> student: yeah, but you haven'tmalloced that space yet for that pointer. >> jason hirschhorn: so i'm not quite sureexactly what you're looking at, because i didn't make that quiz. that was supposed to be a helpfulresource from another tf. if you are creating a string on thestack or as a local variable, it'll just be array of charges rather thangenerally a char star pointing to
another string. but i don't know. that could be a pointer to anotherstring on the stack as well. >> student: i know that you need toallocate memory if the pointer is getting declared insideof another function. do you need to do the same thing if it'sbeing declared inside of main, you're using it inside of main? >> jason hirschhorn: so yes. you can declare a pointer to anymemory address in memory.
it can be the memory address of a localvariable, though oftentimes, people don't declare memory addressesto local variables because they go away once that function returns, whichis why we generally malloc things. but yes, you could declare a pointerto another local variable. it's just generally not done. but i can take a look at thatspecific thing after class. >> student: i think this is sortof what's being asked. it does seem strange to be initializinga pointer not as an address, but as whatseems like a value.
it seems like the cs50 is what's insidethe thing being pointed to and not the actual address, right? >> jason hirschhorn: so that'snot the case, though. that's not what's happening. when you declare a char star,it's a memory address. pointers are all memory addressespointing to something else. that something else could be on thestack, but almost always is on the heap in the way we will see it used. but stringname equals double-quote"getstring," we can see that and we
can look through that and code that. getstring string is not being saved inthat variable, or whatever the string name is is not being saved in thatvariable, because that's not how pointers work. does that make sense? >> student: yeah. >> jason hirschhorn: ok. hopefully, that wasn'tconfusing to anyone. but if it was, we can look at it againin a bit, because we're actually going
to code something that will hopefullywork with strings and help you feel more comfortable with them. >> any other questions related to thesetopics or other topics that i'll put back up? and-- right now. yes, alden. >> alden: so this is completely unrelated,but can we just go over really quickly what we need to knowabout the difference between a 32 and
64-bit machine? so 32 bits is how many bytes? >> alden: it's four bytes. and 64 bits is how many bytes? >> student: eight. >> jason hirschhorn: eight bytes. so again, eight bits is one byte. your cs50 appliance isa 32-bit machine. so memory addresses arefour bytes long.
there are 2 to the 32memory addresses. 0 to 2 to the 32 minus 1. and i am not positive, but that'sprobably the scope of what you need to know for a 32-bit machine, that memoryaddresses are, again, four bytes long, and that's the maximum amountof memory addresses. >> also, data types-- this might be something aswell that's worth noting. the size of a data type depends onthe machine you're working with. so a char, a single character, is howmany bytes on our cs50 appliance?
one byte. and it's actually one byte aswell on a 64-bit machine. >> and most data types are the same numberof bytes on both machines. but some data types will be differenton both machines. so that would be potentially theonly thing you need to know. >> but even that, i think,is beyond the bounds-- i'm almost positive, if you look backat old quizzes, it says, assume for coding problems you're usinga 32-bit machine. but there are, to go along with that incase you're interested, there are
data types that are the samesize on all machines. >> if you've seen something likeuint32_t, you may or may not have seen that. that's a data type. that is saying, be 32 bits no matterwhat machine this is on. so when people are writing portablecode, they probably won't use ints. they'll instead use these other datatypes that they know will be the same size on every single machine. madhu.
>> madhu: i had a question aboutthe compilation process. so if you're writing a program that usesa library like cs50 or something like that, i know that that libraryhas to, at some point, be compiled and linked in. but how much of that happens duringthe compilation of your program? what part of that library processoccurs when you're compiling your own program? >> jason hirschhorn: so let's go overgenerally the steps of this process. you write your .c file.
in your .c file, you #include yourheader libraries, for example, cs50.h. what does that sharp includeline do to your program? akchar. >> akchar: it adds the prototypes ofthe functions from the header files in the libraries. it adds those function prototypesto your code. so when your code is being compiled inthe early stages, the compiler knows that these functions really exist, andthat somewhere they have been defined. the .h files don't include thedefinitions for these functions or how
they actually work. cs50.h just includes something that saysgetstring is a real thing that can happen. and standardio.h says printf isa real thing that can happen. >> so your c language with this .headerfile gets turned into some machine-readable code, which eventuallygets turned into binary code, 0's and 1's. and that's the code that ultimatelygets executed. the -l cs50 line-- for example,when you're writing clang--
and then you include -l cs50,you type that in. and you see that. when you write make, you'llsee that line up here. and we'll see that in a second whenwe code or later on when we code. >> but that -l cs50 line does somethinga bit different than the #include cs50.h. what does that -l cs50 line do? avi? >> avi: i want to say that it linksthe library to the function
call, like the .o files. >> jason hirschhorn: so veryclose, if not spot-on. the -l cs50 takes the binary file andmerges it with your binary file. so cs50.h, there's no point in turningcs50.h from c language to binary every single time it's being used. that would be silly, because thatwould waste a lot of time. so it has already been compiledand turned into an executable. and now it is going to be mergedwith your file at the end. so those 1's and 0's are goingto merge with your ones
and 0's at the end. so now you'll actually have the actual1's and 0's that define how getstring, for example, works, or how printf,for example, works. >> and for more information, there's ashort compilers that nate gives that you should check out that goesthrough these steps. but-- >> student: are they always in .o fileswhen they're in the library form, ready to be merged, linked-- likethey're in the binary code? what--
>> student: is that always the case forthe libraries when you link them? so there's .s files, which will bemachine code, which will also be cryptic to you. you don't need to worry about those. but generally, yeah, they'llbe in .o files ready to go. >> student: so when you ship toa library, do you only ship the .h and the .o? you don't ship the .c or the .s. >> jason hirschhorn: so--
and this is in this short as well, ifthis information seems to be coming a little quickly. but the short on compilerstalks about this as well. when you ship a library, if you shipthe .h, the header file, those function prototypes, and the 1's and0's, that's all you need to give. you don't need to give how thefunction works, the .c file. because the point of abstraction, or thepoint apis, the point at this spl, the stanford portable library, it'sfor you to not worry about how new grect works, or how move works,or how add works.
all you need to know is that addis a function that you can use, and it does this. so you really don't need to know howit's written in c. you just need to know, here are the functions, what theydo, and here are the 1's and 0's when you really want to use them. any more questions on compilersor other topics on the board? >> student: i have a question ofimplementing recursive functions. a question about recursion. i had a feeling that would come up.
so let's quickly go throughrecursion with a specific example, a factorial function. because this is an example thatoften comes up or is used to illustrate recursion. >> so "4!" is read as 4 factorial. and what does 4 factorial mean? what does that do? how do you calculate 4 factorial? 4 times 3 times 2 times 1.
>> so another way to write 4 factorialis to write this. 4 times 3 factorial. because 3 factorial is3 times 2 times 1. so 4 times 3 factorial is 4times 3 times 2 times 1. this is why factorial is a greatcandidate for recursion, because it's clear that there is something thathappens over and over and over on a smaller number of things untilyou reach the end. when you reach 1, 1 factorial is 1. you can't go much further.
0 factorial is also defined as 1. so when you get to 1 or 0, you'reat the end, and you can start going back up. so if we wanted to write a recursivefunction to calculate a factorial, we're going to write somepseudocode for that now. before we write that pseudocode-- i'll give you guys a couple of minutesto write the pseudo code or just think about it-- there are two things everyrecursive function needs. what are those two things?
>> jack: it has to call itself. >> jason hirschhorn: noah? oh, jack. go ahead. >> jason hirschhorn: so a recursivefunction needs a recursive call, a call to itself. that's one. and what's the other thing? >> jack: a base case.
>> jason hirschhorn: a base case. a base case is, here's when we stop. so your function gets called. the base case comes first. you want to know if you're at the end. and if you're not at the end, youmake your recursive call. and you go through this function again,check your base case again. if you're not the end, you makeanother recursive call, et cetera, et cetera.
>> that's why recursive functions alwaysneed those base cases and those recursive calls. if you don't have a recursive call, itwouldn't be a recursive function. if you didn't have a base case,you would go forever and there would be no ending. and the base case always comes first,because you will always want to check if you're at the end first. so before we do some pseudocode, whydon't you take a minute to think about how a recursive factorial functionwould be written?
>> also, as many as you are doing, writingit out on a sheet of paper is what you're going to have todo on the quiz tomorrow. so probably good practice to makesure the code you're writing down on sheet of paper-- or you can do that. you know where the semicolons are. you remember the syntax. because you're not be able to have acompiler tell you made an error. >> also, along those lines, tomorrow, whenyou have coding problems, if you
are rushed for time, or if you're veryconfused as to how you're supposed to write the particular thing in c, itwould behoove you to write pseudo-code or write comments in as well. because there's partial credit for alot of the questions on the quiz. so you might be rushed, or youmight just be confused. writing in comments or pseudo-codeare often ways that you can get partial credit. >> so don't leave somethingblank on the quiz. there's no penalties forputting things in.
in fact, putting in pseudo-code orcomments is going to help the grader figure out if you actually know whatyou're talking about, and maybe award you some partial credit for that. >> also along those lines, write clearly. if we can't really what you're writing,we're not going to call you at midnight tomorrow to figureout what you wrote. we're just going to take off points. write clearly so we can hear, or rather,we can read what you wrote. >> and if it says two sentences,don't write a paragraph.
follow the instructions. write clearly. and write in those comments orpseudocode for questions that could award partial credit. >> ok, let's go to factorial. so we have a function factorial. if i were to actually write this in c,what do i need to put before the name of the function? the return type, which, in thiscase, we'll give it int.
and then inside the curly braces, iswhat goes inside the curly braces for a function? >> students: argument type. >> jason hirschhorn: its arguments. so factorial will probablytake an argument. it'll probably only take one argument. and we'll say it'll takean integer called x. and again, when writing the prototype ofa function or writing the function in your code before defining it, youwrite the data type and the name of
that variable for that function only. so you can pass some number into thisfunction, it'll be referred to as x internally. >> we have our factorial function. we need two things, a base caseand a recursive call. what is the base case for factorial? somebody who wrote it out and who hasn'tspoken yet, what is the base case for factorial? >> student: if n is lessthan 2, return 1.
>> jason hirschhorn: if n isless than 2, return 1. i like that, because thattakes care of 0 and 1. so we'll do x < 2, return 1. if we get passed 0, if we getpassed 1, this function will immediately return 1. if we get passed some number greaterthan or equal to 2, we're going to have our recursive call. >> and so how is that going to work? can somebody else who worked on thiswho hasn't spoken yet give me the
recursive call for this functionin pseudocode? if we get passed in a number xand it's greater than 2, what do we want to do? we also have an example written on theside that might give you a hint. >> student: call x times thefactorial of x minus 1? >> jason hirschhorn: exactly right. we're going to return x timesthe factorial of x minus 1. and that, even though i wrote up,basically, what you said in english, this factorial functionwill get called again.
it'll execute on x minus 1. it'll return with some integer, andthen it'll multiply these two together, and that value will bereturned to whatever called this factorial function, which mightbe another instance of this factorial function. >> so that is an example of a recursivefunction, a very simple recursive function. but most of them will be like this. if you would like a good recursivechallenge for the quiz, try coding
binary search recursively. because if you did binary search forproblem set three, you probably did it iteratively in a while loop. >> but it can also be writtenrecursively. you're going to need to write your ownseparate function that takes some different command-line arguments-- ornot command-line arguments, some different just regular arguments. but you could write binary searchrecursively as well. >> student: so you could have also written,instead of x minus 1, you
could have also written x minusminus, or you could have written minus minus x. can you just explain really quickly whythose would be different things, like what the difference is betweenx minus minus and minus minus x? >> jason hirschhorn: no, i'm notgoing to go into that. but i will talk to you about it afterclass. x minus minus, minus minus x decrement x by 1. but they do it a bit differently. but i don't want to go into that.
other questions about recursionor this function? that's not really even pseudocode. that's basically the code inc you would write for this. >> ok, any other questionsabout topics up here? >> student: i have a quick rundown offloating point and precision. >> jason hirschhorn: floatingpoint and precision. can somebody really quicklygive me a rundown of floating point and precision? you all had to do this for yourproblem set, so you're all
familiar with it. or maybe not all of you. anyone? give me a started spot. floating point and precision. what's the problem? yes. victoria? >> vanessa: vanessa.
>> jason hirschhorn: vanessa. sorry. >> vanessa: there's only a finite numberof numbers that can be represented because you're on a, in ourcase, a 32-bit system. so you kind of have tomake up some numbers. >> jason hirschhorn: so that'sexactly right. there are only a certain amount ofnumbers that can be represented. if you multiply two very large numbers,it might overflow the amount of spaces you have to representan integer.
that's why sometimes we use along long instead of an int. that has more spaces. that can hold a larger number. >> floating point precision has to do withthat, but also has to do with the fact that decimal numbers arenot always represented. let me put this back up. the decimal number 1.0 is not alwaysrepresented like you would expect, 1.000000000. it is sometimes represented as1.000000001 or 0.999999999.
it might be even 89 thrownin there somewhere. so those decimal numbers aren'trepresented exactly like you would expect them to be represented. >> so in problem set-- was it two?-- problem set two, where we dealt withfloating point numbers, when we wanted them to represent exactly what we wantedthem to represent, the number of pennies, or the number of cents,we multiply them by 100. we rounded them.
and then we cut off everythingbehind the decimal point. that was to ensure that they wouldactually equal exactly what we wanted them to equal. >> because when you take something that'sa float and turn it into an int, you cut off everything to the rightof the decimal point. because there's some floating pointimprecision, 100.000 might be represented as 99.999999999. and if you just cut off everything tothe right right away, you're going to get the wrong number.
>> student: i had a questionabout casting. what order does it occur in? if you'd do float, brackets, 1 dividedby 10, does it do 1 divided by 10, then get 0.1, then turnit into a float? >> jason hirschhorn: if you dofloat 1 divided by 10-- >> student: yeah, and then equals-- well, it would normallyhave it equal in-- you want to make it a float, right? >> jason hirschhorn: ok, so we're going touse that to segue into figuring out
the answers to these questionsthrough coding. because you'll probably have a lot ofthese minute questions, and a good way to solve them is through coding. so we're going to code this right now,and then we're going to go back and code the question you had. >> so the first line-- i shouldn't have written it-- what isthe first thing we want to do when we open up a new file in gedit? >> student: include.
>> jason hirschhorn: include what? >> student: cs50 library. what else should we include? we're just going to check what happenswhen you cast something to a float. but what do we need to include if we'regoing to write a c program? >> student: standard i/o. >> jason hirschhorn: stdio.h. we actually don't need, for thisprogram, cs50.h, even though it's always helpful to include it.
but we do always need stdio.h. >> student: when coding in c? >> jason hirschhorn: when coding in c. >> so i save it as this .c file. i get some nice syntax highlighting. i wrote void inside main. what does void mean? >> student: doesn't take anycommand-line arguments. >> jason hirschhorn: void means, in thiscase, main doesn't take any
command-line arguments. in other cases, it means the functiondoesn't take command-line arguments. or the function, if i were to write voidmain(void), that would say main's not returning anything. so void just means nothing. what would i write if i were totake command-line arguments? >> student: int arc c string arc v. >> jason hirschhorn: intargc string argv. is that right?
>> student: it's char star argv brackets. >> jason hirschhorn: so you could writestring argv brackets or char star argv brackets, but you need the brackets. because argv is an arrayof strings, remember. it's not just one string. so string argv is, here'sone string called argv. string argv brackets is, here'san array of strings. so int argc string argv bracketswould be something that i would probably write.
>> so you wanted to save in an integer? >> student: yeah, integer. or in a float. >> jason hirschhorn: in a float? like, float x equals 1 divided by 10. how do i print out a float in printf? what? >> student: %f. >> jason hirschhorn: %f.
what's an integer? d or i. what's a string? >> student: s. >> jason hirschhorn: s. how do i get a new line? >> student: backslash n. >> jason hirschhorn: what do i returnif main runs correctly? >> student: 0.
do i need to write that line, though? >> student: no. ok, we won't write it, then. can everybody read that? it looks a bit small. can everybody see, or shouldi make it bigger? i think for the camera, we'll makeit a bit bigger, though. >> jason hirschhorn: if i want to turn this.c file into an executable, what do i write?
>> student: make test. >> jason hirschhorn: make test. we were talking aboutthis line earlier. clang. what's clang? the name of the compiler. what's this line? >> student: sets it up for use of gdb. >> jason hirschhorn: setsit up for use of gdb.
this line, what's that? >> student: source code. >> jason hirschhorn: that's thesource file, the .c file. what do these two lines do? or these two not lines. >> student: it names it test. >> jason hirschhorn: so the dash o says,name it something differently. and here you're calling it test. if i didn't have that in,what would it name this?
>> student: a.out. >> jason hirschhorn: a.out. what does this do? >> student: links the math library. >> jason hirschhorn: it linksin the math library. we didn't include the math library, butsince that's so common, they've written make to always includethe math library. and likewise, this includesthe cs50 library. >> ok, so if we list, we now havean executable called test.
to execute it, i write test. i see that my floating point,as expected, equals 0. does that-- so-- >> student: then if you put float now,like you cast it as float-- >> jason hirschhorn: castthe 1 to a float? >> student: no, cast the full thing-- yeah. if you just did that, wouldthat make it 0.1?
>> jason hirschhorn: ok, so really quickly,1 divided by 10, those are integers being divided. so when you divide integers, they're0, and you're saving that 0 in a float, because the slash isjust integer division. so now we're turning somethinginto a float. >> let's see what happens. we'll make test. so now we see that that slash was notinteger division, it was floating point division.
because one of its argumentshad been cast to a float. so now it was saying, treat thisdivision like we're dealing with floating points, not with integers. and so we get the answer we expect. >> let's see what happens-- oops. if i wanted to print more decimalspots, how could i do that? >> student: point dot f, or as manydecimal places as you want. >> jason hirschhorn: so i print10 decimal spots.
and we now see we're gettingsome weird stuff. and that goes back to your questionabout floating point imprecision. there's weird stuff stored in here. >> ok, does that answer your question? what else did you wantto code quickly? >> student: i just wanted to see whether ornot, if you freed up some pointer, whether that pointer still had stored init the address of what it had been pointing to previously. >> jason hirschhorn: ok,so let's do that.
char star ptr, this creates a variablecalled ptr of type char star. how do i write malloc? alden? >> alden: just malloc. but then it has to be size of, andin this case, i guess you'd be pointing to char. so it'd be char. >> jason hirschhorn: ok, so moregenerically, inside-- let's edit.
inside malloc, you want the numberof bytes on the heap. generally, what we've seen that we'redoing is we're going to malloc strings, for example, orarrays of integers. so if we want 10 integers, or 10chars, 10 will give us 10. and then size of chars would giveus that size of chars, which in this case is 1 byte. we get 10 bytes. if we were to write size of int,that would give us 40 bytes. >> so more generically, inside of mallocis the number of bytes you want.
in this case, we're getting 1 byte. which seems like a weird useof malloc, but for our purposes makes sense. so there's that. >> we're going to call free. we get rid of it and we use ptr again. and what did you want to check? >> student: i just wanted to check whetheror not there was anything inside of it.
>> jason hirschhorn: so whetherit pointed to anything? >> student: yeah, exactly, whetherit still had a memory address. >> jason hirschhorn: so you wantto check the value of ptr? >> student: yeah, exactly. >> jason hirschhorn: what do i write hereif i want to check the value of the point-- what is, jordansaid, the value? or what is stored inside of ptr? >> student: a memory address. >> jason hirschhorn: a memory address.
so if i write just this, it'llgive me the value of ptr. and how do i print outa memory address? what's the format stringfor a memory address? >> student: %p. >> jason hirschhorn: %p. %s is a string. %p for pointer. that is right. so ptr equals--
it still has something in it. this is probably a moreinteresting question. what does that line do? >> student: seg faults. >> jason hirschhorn: what? >> student: i think it seg faults. >> jason hirschhorn: hm? >> student: i think it'll seg fault. >> jason hirschhorn: so this lineof code, star ptr, what
does the star mean? >> student: content of. >> jason hirschhorn: yeah. go to get the content of. so this is going to go to the memoryaddress there and give me that. i used %c right here because thereare characters stored there. so we're going to go to that address wejust saw-- or it'll probably be a little bit different thistime we run the program. but we'll go to that addresswhich we know still exists
and see what's there. >> so it didn't seg fault. it just didn't give us anything. it might have actually given ussomething, we just can't see it. and that goes back to this idea-- and we're not going to get too much intothis, because that's beyond the scope of this course. but we talked about right here, if wewent beyond the bounds of the array by 1, we might not get in trouble.
>> sometimes, when you just go off by 1,you're doing something wrong, and you could get in trouble. but you don't always get in trouble. it depends how much of a bad thing youdo, you're going to get in trouble. which isn't to say, be sloppywith your code. but it is to say, the program won'talways quit, even if you go somewhere you're not supposed to go. >> a good example of that is, a lot ofpeople in their problem set 3, which was 15, did not check thebounds of the board.
so you looked to the left, looked to theright, looked to the top, looked to the bottom. but you didn't check to see if the topwas actually going to be on the board. and a lot of people who did that andturned that in, their program worked perfectly, because where that board wasstored in memory, if you went one above it or checked that memoryaddress, there wasn't anything particularly horrible about that,so your program wasn't going to yell at you. >> but we would still take off points ifyou didn't check that, because you
were doing something you weren'tsupposed to do, and you could have gotten in trouble. odds are, though, you probably didn't. so this is to show that, yes,we can still go to it. and we're not getting introuble in this case. if we tried to do read thenext 100 characters, we'd probably get in trouble. and you can code reading the next 100characters if you want by doing some sort of for loop.
>> student: since we were assigned thatspace an actual value, we wouldn't actually be able to see anything. should we try it with setting thatequal to like c or something? how do i set that value-- what line of code do i write on lineseven to do what you said? >> student: star ptr equals singlequote c end single quote. >> jason hirschhorn: so that's puttinga character, c, at that location, because again, that starmeans go to there. and when used on the left hand side ofan assignment operator, that equals
sign, we're not going to get thatvalue so much as set that value. now let's see what happens. >> we put something thereand it was there. we called free. some stuff probably happenedon the heap. so it's not there anymore. but again, we're not gettingin trouble for going there. >> i'm doing this out in code to illustratethat a lot of these questions that you have, they'rereally interesting
answers a lot of time. and they're really good questions. and you can figure them out onyour own if, for example, we're not in section. >> student: because you're not sending thepointer anywhere, do you need to use malloc? >> jason hirschhorn: so this goes backto your initial question. [? ?] is it just a local variable?
malloc here is not that compelling. the use of malloc here is notthat compelling because it's just a local variable. >> student: so could you do charstar ptr equals hello? >> jason hirschhorn: oh. so we're going to now get backto your initial question. i think you weren't satisfiedwith my answer. ok? like that?
wait. >> jason hirschhorn: and wheredo you want to print out? so we'll print out a string like that? >> student: interesting. >> jason hirschhorn: so this says thisargument has the type of a character. so this should be a character. >> student: just takes the first one. >> jason hirschhorn: so thisis what i said before. like i said, it's not storing thestring inside variable pointer.
it's storing-- >> student: the first valueof the string. >> jason hirschhorn: the address ofthe first value of the string. if we were to print out this, we'regetting the value inside pointer. and we'll see it is, indeed,a memory address. >> does that make sense? wait, does that answer yourquestion, though? >> jason hirschhorn: this line of code iscreating a string and then another variable pointer that's pointingto that string, that array.
>> student: so if we went one memoryaddress further, would we get the h? has it been stored as a string? >> jason hirschhorn: like, we did-- so this is valuable to do. this is point arithmetic, which you guyshave seen before and should be relatively comfortable with. this is akin to writing-- if we were to write this line of code,we've seen array notation before. this should give us the secondvalue in this array, h.
>> if we did this, this should also giveus the second value in that array. because it is going not to the memoryaddress of the first thing, but the memory address of the thing one over. and then the star operator dereferencesthat pointer. and again, let's see. we get h again. >> student: what exactly doesdereference mean? >> jason hirschhorn: dereferenceis a fancy word for go to. go to that and get what's thereis to dereference a pointer.
it's just a fancy word for that. >> student: if we wanted to printthe whole string, could we do ampersand pointer? >> jason hirschhorn: ok, we aregoing to pause here. we are going to end here. ampersand gives you the address of alocation, so when you do ampersand of a variable, it gives you the addresswhere that variable is stored. ampersand pointer will give you theaddress of ptr where ptr is in memory. >> we're not going to go onwith this example.
you can figure out thesethings on your own. but again, this might even be verging abit beyond what you need to know for the scope of this mid-term-- or this quiz, rather. >> we are going to move on, because i wouldlike to do one coding problem before time is up. and we are going to code what i thinkis the most compelling of these examples, atoi. so this was a question ona quiz two years ago.
and i have it on the board here. >> people were asked on the quiz-- they were given a little more tesxt inthe question, but i eliminated the text because it was unnecessaryfor our purposes now. it was just some backgroundon what atoi did. but you all know and are veryfamiliar with atoi. >> i suggest you code thison a sheet of paper. i also suggest you use the strategythat we've gone over a lot in our section.
first, make sure you understandwhat atoi's doing. draw a picture or come up with somemental image of it in your head. next, write out pseudocode for this. on the quiz, if all you get ispseudocode, at least you put something down. and then map that pseudocode ontoc. if you have a check in your pseudocode, like check if somethingis 1, that maps onto an if condition and so forth. and finally, code the program in c.
>> so go back to atoi and take five minutesto code this on a sheet of paper, which is probably about theamount of time you would take on a quiz to code atoi. five to 15 minutes, five to 12, five to10 minutes, is about the amount of time you'd spend on thisquestion in the quiz. so take five minutes now, please. and if you have any questions, raiseyour hand and i'll come around. >> [side conversations] >> jason hirschhorn: ok, sothat was five minutes.
that was probably about the amount oftime you'd spend on that on a quiz, maybe the low end of that time. we'll recap in a bit. let us start coding this. and if we don't get all the way through,the answers to this and this quiz question are available, again,fall 2011 is when this question appeared on the quiz. >> and it was worth eight pointson the quiz then. eight points is on the high end of theamount of points something is worth.
most questions are in the rangeof one to six points. so this is a more challengingquestion, for sure. can anybody get me started? >> generally, what are we goingto want to do with this function atoi, logically? what do we want to do? so we're going to writesome pseudocode. >> student: convert charactersinto integers. >> jason hirschhorn: convert charactersinto integers.
so how many characters are wegoing to need to go through? >> student: all of them. >> student: all the charactersin the string. >> jason hirschhorn: all of thecharacters in the string. so if we wanted to go through everycharacter in a string, what is a thing in c we've seen that has allowedus to go through every character in a string? >> students: a for loop. >> jason hirschhorn: a for loop.
so we're going to loop throughevery character in s. >> then what are we going to want to dowhen we get a specific character? say we're getting passed a 90. we get the 9. it's a character. what do we want to do withthat character 9? >> student: subtract it from character 0? >> student: add 0? >> jason hirschhorn: subtractit from character 0?
>> jason hirschhorn: why doyou want to do that? >> student: [inaudible] value. its int value. >> jason hirschhorn: ok, so we take thecharacter 9, subtract it from character 0 to get anactual integer 9. and how do you know that character9 minus 0 character is 9? what chart did you look at? >> student: there are logically nineplaces between 9 and 0.
or you could look at the ascii table. >> jason hirschhorn: ascii table. but yes, you're correct as well. so we subtract 0. so now we have the integer 9. and what do we want to do with that? if we have 90, it's the first integerwe have, what we want to do? >> student: i'd put in a temporary integerarray, then do math to it later to make it into an end.
>> student: you can start at the end ofthe array and then move forward so that every time you move forward,you multiply it by 10. that sounds like a prettycompelling idea. we can start at the end of our array,and we can use strleng. we can use strleng in here. we'll get the length of our string. we start at the end. and + the first one, we just take thatinteger, and maybe we create like a new integer variable up top wherewe're storing everything.
so we loop through every char in s fromback to front, we subtract 0, and then we take it, and depending onwhere it is, we multiply it by a power of 10. because the first one, what do wemultiply the rightmost character by? >> student: 10 to the 0. >> jason hirschhorn: 10 to the 0. what do we multiply the secondrightmost character by? >> student: 10 to the 1. >> jason hirschhorn: 10 to the 1.
the third-rightmost character? >> student: 10 to the 2. >> jason hirschhorn: 10 to the 2. >> student: sorry, i don't understandwhat we're doing here. >> jason hirschhorn: ok,let's go back, then. so we're going to getpassed in a string. because we're writing atoi. so we get passed in a string. say we're getting passedin the string 90.
>> the first thing we're going to do is seta new integer variable that we're just going to createas our new integer. that's what we're goingto return at the end. we need to go through every character inthe string because we've determined that we need to touch each one andthen add it to our new integer. >> but we can't just add it as a number. we can't just take 9 andadd 9 to our integer. it depends on what placeit is in the string. we're going to need to multiplyit by a power of 10.
because that's how base 10 works. >> so we're going to get the actualcharacter, or the actual integer number, by subtracting character 0from character 9 like we did with subtracting character capital a fromwhatever character we had in one of those problems. so we'll actually get a number from 0 to9 saved as a real number, and we'll multiply it by a power of 10 dependingon where we are in the string. and then we're going to add it backinto our new integer variable. >> so what this would look like wouldbe-- we'll draw over here.
if we get passed in the string 90-- >> jason hirschhorn: butatoi takes a string. so we're going to go throughthe holding. we'll get passed in 90. we go from the back to the front. we take the 0. >> student: i'm sorry. maybe this is stupid. if we're getting passed in a string,why is 90 what we're
getting passed in? because 90 is an integer. >> jason hirschhorn: because atoi takes astring and turns it into the integer representation of that string. but the string 90 is not the integer90 or the number 90. the string 90 is an array of two, orthree characters, rather, the 9 character, the 0 character, andthe backslash 0 character. >> and we're writing atoi because, forexample, when you take the command line argument, and it's saved inargv, it's saved as a string.
but if you want to treat it as a number,you need to convert it to an actual integer. which we did one of our problem sets. which we did in a numberof our problem sets. everyone that took an integeras a command line argument. so that's why our atoi functiontakes a string. >> so again, in our example here, we'regoing to take the last one. we're going to subtract the character0 from it, because the characters 0 subtracted by the character 0 gives youthe actual number 0, according to
the ascii math that we do. >> because characters are represented asdifferent than their actual-- the character a, for example,lowercase a is 97. it's not-- oops! it's not whatever you would expectit to be, 0, for example. so you have to subtract thecharacter a to get 0. >> so we're going to do that hereto get the actual number. and then we are going to multiply it bya power of 10 depending on where it is in the string, and then take thatand add it to our place holder
variable so we can come up withour final new integer. does that makes sense to everyone? >> so we're not going to code thisright now, because we're getting short on time. i apologize for the timing of that. but this is what, hopefully, you wouldbe able to do on the quiz-- at the very least, get this pseudocodewritten out. >> and then, if we were to write thepseudocode, actually, we could do this pretty quickly.
each line of comments we we wrotehere translates to about one line of c code. declaring a new variable, writinga loop, some subtraction, some multiplication, and some assignment. we'd probably also want towrite a return line. we might also want to putsome checks in here. >> student: so can we treats as the actual string? because i know it's just an address. like, how would you get the length ofthe string being passed through?
>> jason hirschhorn: so how didthe length of a string? strlen. >> student: strlen, yeah. but can you put s as theargument for that? >> jason hirschhorn: so strlentakes a char star. and it follows that char star, and itkeeps counting until it gets to a backslash 0. strlen was actuallyone of the other programs we were going to code. that's another good one to code.
that one's a bit easier, because ifyou're going to think about that conceptually-- i just said it out loud-- strlen followsa pointer and keeps going and counting and keeping track untilyou reach a backslash 0. >> student: ok, got it. >> jason hirschhorn: so best ofluck on quiz 0 tomorrow. if you have any questions, i'llbe outside after this. feel free to email me. reach out to your own tf if you'renot in my section, or get my
email if you want it. >> if you want to freak out and just sendme an email, a freakout email, i'll send you back, like, a smiley face,or, like, a joke or something. so feel free to do that as well. good luck again, and i'llsee you all next week.
0 Response to "cara mendapatkan samsung s4 line"
Post a Comment