🐰🐾 سمیه
but it just has one character which is s[0]
BinaryByter
yes
BinaryByter
it only writes to that character
BinaryByter
get experience
MᏫᎻᎯᎷᎷᎬᎠ
Yeah
MᏫᎻᎯᎷᎷᎬᎠ
Code something
🐰🐾 سمیه
it only writes to that character
if the condition is met,that is, s[0] is equal to ' ' or '\t', what happens next?
BinaryByter
what do you expect it to?
MᏫᎻᎯᎷᎷᎬᎠ
⁦⊂(´・◡・⊂ )∘˚˳°⁩
🐰🐾 سمیه
what do you expect it to?
I dont know exactly.😶
BinaryByter
What would happen with a while () { } ?
🐰🐾 سمیه
if a condition in while is met, the body executes
BinaryByter
yes
BinaryByter
and if there is no body?
🐰🐾 سمیه
it moves on to the next statement
BinaryByter
no
BinaryByter
it just goes back to the condition
BinaryByter
until the condition isn't met anymore
Anonymous
Raul
Wat
BinaryByter
BinaryByter
sure :D
Anonymous
Anonymous
🙄🤔
Anonymous
BinaryByter
kek
Anonymous
Can someone suggest me how to and from where to practice dynamic programming
olli
Can someone suggest me how to and from where to practice dynamic programming
https://leetcode.com/problemset/all/?topicSlugs=dynamic-programming
🐰🐾 سمیه
Hi, does anyone know what the function ungetch() does? in line 9.
Ariana
send the whole code
🐰🐾 سمیه
you mean the whole number?
🐰🐾 سمیه
I think return is supposed to do that, but it returns NUMBER which is zero.
Carmine
Hi, does anyone know what the function ungetch() does? in line 9.
“ungetch() is not a C standard library function, but it’s usually provided by compiler suites. It “puts back” the last received character to the stream, making it available for the next getch() call.” https://www.quora.com/What-are-getch-ungetch-in-C-Language
olli
Hi, does anyone know what the function ungetch() does? in line 9.
https://pubs.opengroup.org/onlinepubs/7908799/xcurses/ungetch.html
🐰🐾 سمیه
🐰🐾 سمیه
Hi, function getch( ), showed in below picture, is in function getop(), showed in above picture. Could you please explain to me what is being done in line 16 in getch( ) ?
🐰🐾 سمیه
previously in line 12, it has set the value of bufp to zero. so why it checks if it's bigger than zero in line 16 ?
🐰🐾 سمیه
and how -- bufp happens when its value is alreay zero?
olli
Hi, function getch( ), showed in below picture, is in function getop(), showed in above picture. Could you please explain to me what is being done in line 16 in getch( ) ?
if some characters have been pushed back using ungetch it retrieves the last one, otherwise it returns the charachter returned by getchar
🐰🐾 سمیه
olli
would you please clarify by an example?
calling ungetch places the character into the buffer buf and increases bufp if enough space is available. The next time you call getch you want to read the pushed backed characters. Hence you check whethre some exist and if so return them, otherwise call getchar ungetch('a') => buf = { 'a', ...... } ungetch('b') => buf = { 'a', 'b', .... } getch() => 'b' | buf = { 'a', .... } getch() => 'a' | buf = { .... } getch() => getchar()
Raul
How many times are you going to ask what getch does?
Raul
We have the almighty Google that can explain what getch and ungetch does
BinaryByter
🐰🐾 سمیه
for what task I need to call it?
BinaryByter
when you need to push something on that buffer
🐰🐾 سمیه
when I need to push something on that buffer?
BinaryByter
Dunno
BinaryByter
that method is not that used tbh
🐰🐾 سمیه
It's for educational purposes.
Raul
I mean you've asked what does it do this entire day.
BinaryByter
xD
Raul
And poor Max here has answered it at least 3 or 4 times now.
BinaryByter
xD
BinaryByter
IIRC she has only asked that once exactly
Raul
So you may as well look up another source other than us if our answers aren't satisfactory enough for you.
BinaryByter
google.com should be your main source
BinaryByter
thank you Raul :D
Raul
Yeet
BinaryByter
Yeet your feet!
BinaryByter
:D
Raul
My feet are yeeted
Raul
Lol
BinaryByter
perfect!
🐰🐾 سمیه
BinaryByter
what?
🐰🐾 سمیه
nothing
🐰🐾 سمیه
☺️
BinaryByter
ok
olli
when exactly ungetch( ) is called?
whenever some one calls it. - e.g. in getop from your first picture
🐰🐾 سمیه
whenever some one calls it. - e.g. in getop from your first picture
I mean in getop it is called at the end; when all digits are stored in s[ i ]. why at the end ? and what it does at that point?
olli
I mean in getop it is called at the end; when all digits are stored in s[ i ]. why at the end ? and what it does at that point?
because this implementation of getopt reads one character more than it should. If the additional character is not EOF then it should be restored, because some other read operation might depend on it What does getop do for an input such as 2+2 ?