postfix vs. prefix increment operator | C Programming Tutorial

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

You are the BEST learning resource on YT for these things. THANK YOU.

andreytheeditor
Автор

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

davidlandivar
Автор

And I just found your playlist ( examples in C)
It's amazing 🤩
Keep going ❤️♥️

abdelazizelhayyany
Автор

Excellent explanation, I finally got it! Thank you!

tiagoalvs
Автор

Eccezionale Professore argomento spiegato in modo semplice.Un saluto

massimorusso
Автор

Great explanation... Could you please do a follow-up video on manually implementing strcpy(), this time using this: "while(*strDest++ = *strSrc++); " kind of syntax, which uses the postfix concept ? Thank you!

hshshkaalbsb
Автор

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"

hikineeto
Автор

Tks Sir!
int a = 10;
int b;
b = a++ + ++a;
printf("%d %d %d %d", b, a++, a, ++a)
So in the printf() function, what is the order of calculation variable a?
Tks you so much for explaining !

cennycoding
Автор

You can use make demo && ./demo
No need to type with gcc for compiling C code. make command is easier and requires less words.

md.redwanhossain
Автор

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. "

justcurious
Автор

You aremagnificient thank you i appreciate it

biryazlmhikayesi
Автор

"Don't use a feature of the code because programmers can't remember how the feature works." That's an interesting take on the issue. Maybe they shouldn't advertise themselves as programmers of they can't remember c coding 101.

charlescox