Комментарии:
It’s incredible how you can be told the concept in dozens of ways, but the simplest and most effective one comes from the smartest mind. This doesn’t have to be hard, but if it becomes hard when the person instructing is not intelligent like you. Thank you so much l. Also thank you for not doing an Indian accent
Ответитьresult = i++ * 10;
I wonder which one happens first in the statement above:
i) incrementing i
ii) storing the value of (i * 10) in the variable "result"
So I was just trying to understand why the postfix operator has the highest precedence among all other operators according to cppreference , so I tried this expression :
int i = 1 ;
int result = i++*10*2 ; // I thought it's equivalent to something like this (i*10)++*2 = 22
but the result is 20 which mean the variable i never incremented ,
ChatGPT explanation :
" The equivalent expression to i++*10*2 using parentheses is (i++) * 10 * 2.
This is because the post-increment operator ++ has a higher precedence than multiplication * operator in C, which means that i++ is evaluated first, and then the multiplication takes place.
By using parentheses to explicitly group the i++ expression, we ensure that the post-increment operator is applied to i before the multiplication takes place, just as it was in the original expression. "
thank you so much
ОтветитьExcellent explanation, I finally got it! Thank you!
ОтветитьYou can use make demo && ./demo
No need to type with gcc for compiling C code. make command is easier and requires less words.
Nice and your voice is like Thanos 😅
ОтветитьYou aremagnificient thank you i appreciate it
ОтветитьAnd I just found your playlist ( examples in C)
It's amazing 🤩
Keep going ❤️♥️