Linked Questions
63 questions linked to/from Post-increment and Pre-increment concept?
0 votes
10 answers
26k views
how does if (i++) condition work? [duplicate]
Possible Duplicate: Post Increment and Pre Increment concept? I cant understand how the "if condition" works with the increment/decrement operator in this scenario: #include<stdio.h> void ...
0 votes
2 answers
14k views
prefix/suffix increment [duplicate]
Possible Duplicate: Post Increment and Pre Increment concept? Can any one explicitly explain how prefix increment differs from suffix increment? also can someone explain why this output 6? i=1; ...
0 votes
6 answers
10k views
C++ x+=1 x++ and x = x +1 are not the same? [duplicate]
I can not grasp the concept as to how these statements produce different values. As far as I know x+=1, means x = x + 1. I also know that x++ should be equivalent to x + 1. I've also searched this ...
0 votes
4 answers
3k views
Post-Increment in Recursive Method? [duplicate]
I'm trying to learn java oop and i find some problem understanding why the use of post-increment in Recursive Method cause error ? I don't understand . Main Class : public class Main { ...
-1 votes
7 answers
179 views
Why can't return ( (a++) %4) [duplicate]
I have a C function: static uint8_t func( uint8_t a ) { return ( (a++) % 4 ); } When I call it: uint8_t b = 0; b = func(b); I found b still is 0 not 1. Why?
-1 votes
4 answers
1k views
When should we use ++x and x++? [duplicate]
What is the difference between ++x and x++? I know ++x increments then return the value. and x++ assign the value then adds. But I'm still not sure how it works and when to use either one. Please ...
0 votes
3 answers
192 views
I don't understand why a equals 1 and b equals 0 in this program [duplicate]
I don't understand why a equals 1 and b equals 0 at the end. They should be the same in my view. Thanks in advance. #include "stdio.h" int main() { int a=0; int b=0; a++; printf("a=%...
0 votes
3 answers
169 views
C++ and ++ operators [duplicate]
so I am looking at the following snippet of code int a = 3; int b = 2; b = a++; cout << ++b; My understanding line by line is: initiate a = 3 initiate b = 2; assign the value of (a+1) to b, so ...
0 votes
3 answers
503 views
How does incrementing an element(integer) in array work in C? [duplicate]
int main(){ int a[5]= {5, 1, 15, 20, 25}; int i, j, k=1, m; i = ++a[1]; // i becomes a[1] + 1 which is 2 but a[1] changes to 2 even though I'm assigning a value to i? j = a[1]++; // j ...
0 votes
1 answer
306 views
Confusion about Dereferencing and Incrementing [duplicate]
just today I stumbled across this short piece of code that confused me a little. #include <iostream> #include <iterator> int main() { int array[] = {0,1,2,3,4,5,6,7,8,9}; auto start = ...
0 votes
2 answers
128 views
Not understanding the operation pre and post increment [duplicate]
I have following C program and I'm not understanding the output of this program: #include <stdio.h> int main() { int a=8; printf("%d\n", a++); printf("%d\n", ++a); printf("%...
-3 votes
3 answers
241 views
Increments --i and i-- [duplicate]
Please can someone clearly explain to me in a very detailed layman understanding manner. The actually difference between --i and i-- And where exactly should which be used over which. Example or ...
-3 votes
2 answers
90 views
C++ operation too confusing? [duplicate]
I can't seem to understand this operation. What is the output of the following code? I've tried interpreting why b has two different values one as b=1+2 and the other as b=2, since a++ should equal ...
0 votes
1 answer
62 views
what is the diffrent between these codes:one of them does'nt change label text [duplicate]
I wrote this code to change label text. but id does not change: void DateTimes::on_btnHourP_clicked() { int h=ui->txtHour->text().toInt(); if(h==24) h=-1; ui->txtHour-...
0 votes
1 answer
64 views
What happened in the function convert(&m)? [duplicate]
Here is the code: int convert(int* a) { return (*a)++; } int main(){ int m = 56; int n = convert(&m); cout << m << endl; m = convert(&m); cout << m &...