Search
 
SCRIPT & CODE EXAMPLE
 

CPP

what is the difference between i++ and ++ i ?

 i = 1;
 j = ++i;
 (i is 2, j is 2)
 //diference
 i = 1;
 j = i++;
 (i is 2, j is 1)
Comment

++i vs i++

// ++i will increment the value of i, and then return the incremented value.

 i = 1;
 j = ++i;
 (i is 2, j is 2)

// i++ will increment the value of i, but return the original value that i held before being incremented.

 i = 1;
 j = i++;
 (i is 2, j is 1)

Comment

the difference between i++ and ++i

 i = 1;
 j = i++;
 (i is 2, j is 1)
Comment

the difference between i++ and ++i

 i = 1;
 j = ++i;
 (i is 2, j is 2)
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to read wav file in C++ 
Cpp :: how to make for loop in c++ 
Cpp :: infinite loop c++ 
Cpp :: c++ ros publisher 
Cpp :: reverse c++ string 
Cpp :: how to run a c++ file from terminal linux 
Cpp :: how to convert int to string c++ 
Cpp :: Appending a vector to a vector in C++ 
Cpp :: how to round a double to 2 decimal places in c++ 
Cpp :: parallelize for loop c++ 
Cpp :: print float number with only four places after the decimal point in c++ 
Cpp :: C++ switch cases 
Cpp :: how to round to nearest whole number unity 
Cpp :: string to int in c++ 
Cpp :: What should main() return in C++? 
Cpp :: c++ std::sort 
Cpp :: c++ console color 
Cpp :: c++ call method in same class 
Cpp :: c++ vector pop_back 
Cpp :: C++ array sort method 
Cpp :: how to easily trim a str in c++ 
Cpp :: c++ cast char to string 
Cpp :: sort 0 1 2 leetcode 
Cpp :: convert decimal to binary in c++ 
Cpp :: how to initialize array with new in c++ 
Cpp :: how to find the size of a character array in c++ 
Cpp :: palindrome checker in c++ 
Cpp :: how to reverse a string in c++ 
Cpp :: c++ hashmaps 
Cpp :: c++ vs g++ 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =