DEV Community

Abror_7
Abror_7

Posted on • Edited on

Incremaent/decrement Operator

Increment/Decrement operatorlari o'zgaruvchini bitta oshirib berish yoki kamaytirib berish . a++,++a,b++,++b,a--,--a,b--,--b.

  • Agar ++,-- a yoki boshqa o'zgaruvchilardan oldin kelsa unda o'sha qatordan boshlab hamma pastki qatorlarda o'sha o'zgaruvchi bitta songa oshadi yoki kamayadi.

#include <iostream>
using namespace std;
int main (){
  int a = 67;
  int z = 16;
  int c = --a + z++;
  cout << c;
return 0;
}
Enter fullscreen mode Exit fullscreen mode
  • Agar ++,-- a yoki boshqa o'zgaruvchilardan keyin kelsa unda pastki qatordan boshlab o'zgaruvchi birga oshadi yoki kamayadi.

#include <iostream>
using namespace std;
int main (){
  int a = 67;
  int z = 16;
  int g = a++ + z++;
  cout << g;
return 0;
}
Enter fullscreen mode Exit fullscreen mode

@dawroun

Top comments (0)