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 :: operator overloading in c++ 
Cpp :: how to insert in a queue c++ 
Cpp :: if not c++ 
Cpp :: if in c++ 
Cpp :: c++ length of int 
Cpp :: valid parentheses in cpp 
Cpp :: insertion overloading in c++ 
Cpp :: nth fibonacci number 
Cpp :: c++ pointers 
Cpp :: even and odd numbers 1 to 100 
Cpp :: sort 2d vector c++ 
Cpp :: c++ allocate dynamic with initial values 
Cpp :: substring function in c++ 
Cpp :: cpprestsdk send file 
Cpp :: c++ download 
Cpp :: error C2011 
Cpp :: lap trinh file explorer c++ 
Cpp :: curl upload folder and subfolders 
Cpp :: vector int initialize with increasing numbers 
Cpp :: gdb get return value of function 
Cpp :: C++ Modified Data Types List 
Cpp :: cout ascii art c++ 
Cpp :: https://www.cplusplus.com/doc/tutorial/pointers/ 
Cpp :: is variable sized array are not allowed in c++? 
Cpp :: sinh nhi phan c++ 
Cpp :: stack algorithm in c++ 
Cpp :: how to add values in empty array using python 
Cpp :: C++ Single Line Comments 
Cpp :: how to check private messages on reddit 
Cpp :: ue4 set size of widget c++ 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =