Anonymous
if will execute if 1 is inside it?
Will only not execute the part after if() when i=0
Lionel
if will execute if 1 is inside it?
Think of recursive functions like pushing into the stack.
Lionel
After pushing inside, when the conditions fail
Lionel
U have to pop it. So the condition fails when it becomes 0. So it will be printed the number of times it has successfully satisfied the condition, that is, three times
Lionel
3 2 1, which is not 0. So thrice conditions are satisfied
Lionel
It fails at 0. So the value is 0 now.
Lionel
U r popping it. So printf will be printed thrice
Shlok
void recurse() { static int i = 4; if (--i) { recurse(); printf("%d", i); } }
I am unable to understand how how if(--i) will give boolean result
Lionel
It's quite easy if u understand the concept
Shlok
I think its above my level
YK Y
at the returning time it'll print 3 times zero right?
Anonymous
For starters 😁
Lionel
I think its above my level
No dude. If(1) means true. If(0) means false
Anonymous
Anyone with a pdf that could help
Lionel
at the returning time it'll print 3 times zero right?
Yes. Draw the stack and check it. U would understand it.
Anonymous
I am unable to understand how how if(--i) will give boolean result
--i means include the statement i=i-1 before everything
Anonymous
I only have basics😁
YK Y
No dude. If(1) means true. If(0) means false
if(2)? will it go inside the if?
Lionel
I only have basics😁
Watch YouTube tutorials.
Lionel
if(2)? will it go inside the if?
Non zero means it's true
Lionel
If (-1) is true
jack
there will be no output...
YK Y
Non zero means it's true
i got it thank you:)
Lionel
Zero means false
🥂ɱɾ.ɱ🥂
I am looking for a book. His name is C ++ How to program (2012) Author Daytl and Daytl If you send it to me?
Anonymous
Anonymous
If I send then?
Lionel
Just saying 😂
Anonymous
I am real tempted to ban ya
At least let her complete her end of the deal...
Anonymous
She's stuck on the if...
Anonymous
Just saying 😂
Do you have any pdf material that you could help😁 I understand fast through reading 😂
klimi
Anonymous
?
If I send you that pdf what will you give me?
YK Y
if recurse(4)
Shlok
Do you have any pdf material that you could help😁 I understand fast through reading 😂
Google tip Add filetype:pdf after book name then only pdf i will come in result
Anonymous
Ooops
klimi
Okay ~
klimi
I should block him asap
klimi
So he doesn't write to me that I should unban him
Anonymous
Okay ~
Sorry😂
klimi
Sorry😂
Its alright SIR
klimi
Sorry😂
#WARN: Chat: C/C++ Admin: Danya User: ShonaBunny User ID: 824741723 Reason: I can say you only a warn for offtop #WARNACTION: Chat: C/C++ Admin: Danya User: 🐕Melika🐇 User ID: 424351553 Reason: I can send you a warn for violating rules
klimi
Damn you repeat too much man
Anonymous
Damn you repeat too much man
It's my pattern I'm not @Neko_cpp
klimi
XD ok
YK Y
void recurse() { int i = 4; if (--i) { recurse(); printf("%d", i); } }
Shlok
Infinite loop
Shlok
If if(--i) become true at some time then answer would be 1
YK Y
If if(--i) become true at some time then answer would be 1
if(--i) is becoming true at the first time
Shlok
These people are sayi g that it will become true.
YK Y
U should use static keyword
stack will overload without static?
Lionel
stack will overload without static?
It doesn't maintain a single copy of the variable
Lionel
And it will declare everytime it enters the func and it should result in error
Lionel
Segmentation fault
Artöm
if(--i) is becoming true at the first time
Each time i is a different variable
Artöm
error why?
Because function call takes some stack space which isnt infinite
Artöm
I see you understood
Artöm
It is auto, not static
Anonymous
anyone with decent algo for this?
Artöm
anyone with decent algo for this?
Think it yorself man. You need only 2 for cycles
Artöm
By the way, I was taught to do indexing in such cases in university, one of actually useful classes
Anonymous
I asked for decent algo I already have dry run many algo but corner cases aren't being under repetation.. and also green and blue square being 3 if else ...