Examples of using Getstring in English and their translations into Slovak
{-}
-
Colloquial
-
Official
-
Medicine
-
Financial
-
Ecclesiastic
-
Official/political
-
Computer
-
Programming
GetString and getInt have.
Something goes wrong with getString.
Like getString, and storing.
So I already called getString, which.
GetString, as we will see, literally.
Notice that we're using getString.
GetString works, presumably, it's.
Calls our own function, getString.
GetString, of course, gets a string.
GetInt calls our own function, getString.
Something goes wrong with getString, we have got to be able to handle that.
It's declaring two variables up top, s and t, and calling getString.
Oh, the getString, because it would be inputted into each[? area.?].
So there's s on the left, and then getString on the right.
So I already called getString, which means I have a string in memory.
And then there's t on the left, and then getString on the right.
Let's now call a function called readLine,which is similar in spirit to getString in the CS50 library for C. But readLine also takes an argument that specifies the prompt that you would like to show to the user.
MALAN: And which piece of the picture are you drawing right now? The call to getString? Or the declaration of s?
Well, all this time, if we have been calling a function, like getString, and storing the so-called return value of getString in a variable-- it's called s type string-- we have been writing the line of code up there above.
However, let's assume that, on the right-hand side is, nonetheless,a reasonable depiction of what's been going on all this time with getString.
If I were to type in gabe again, a second time,when prompted with getString, where, of course, is gabe going to go? Well, presumably--.
If you consider now how getString works, presumably, it's been asking someone for a chunk of memory, anytime the user types a string in, because we certainly didn't know, as CS50 staff, how big those strings that humans are going to type might be.
So even though I have allocated a char star that's no longer called s, it's instead called, buffer-- so let's draw the variable's name now asbuffer-- if I haven't called getString or malloc here, that effectively means that buffer is just some garbage value.
But it turns out, all this time, whenever you have called getString in so many of our programs, you're asking the operating system for memory, but you have any recollection of ever giving it back, doing unalloc, or free, as it's called.
If the string that the user typed in is way too long to fit into memory,or some weird corner case like that, getString, as we will see, literally today, in its documentation, says it will return null as a special sentinel value, or just sort of a special symbol that means something went wrong.