Computer Science, asked by khiladi295, 11 months ago

what is the difference between ++a and a++

Answers

Answered by jainaditya0411
1

++a is a pre-increment operator, which means that it will increase value of a by 1 before executing the statement.

ex- int a=2,i;

     i=++a;


this program will result in value of i = 3 as value of a was increased by 1 before execution of that statement



a++ is a post-increment operator, which means that it will increase value of a by 1 after executing the statement.

ex- int a=2,i;

     i=a++;


this program will result in value of i = 2 as value of a was increased by 1 after execution of that statement


jainaditya0411: pls mark me brainliest
khiladi295: how to mark
jainaditya0411: what do you mean
jainaditya0411: ohhh I understood
khiladi295: hm nhi jaante hai ki kaise kiya jata hai . Tum batao tb krte hai
jainaditya0411: there must be a button on which 'mark as brainliest' must be written below the answer
jainaditya0411: press that
jainaditya0411: you thanked me but pls mark brainliest
khiladi295: are bhai option he ni aa rha hai
jainaditya0411: Not possible
Answered by Anonymous
2

\Huge{\textbf{\textsf{\color{navy}{An}{\purple{sW}{\pink{eR}{\color{pink}{:-}}}}}}}

++a is a pre-increment operator, which means that it will increase value of a by 1 before executing the statement.

ex- int a=2,i;

     i=++a;

this program will result in value of i = 3 as value of a was increased by 1 before execution of that statement

a++ is a post-increment operator, which means that it will increase value of a by 1 after executing the statement.

ex- int a=2,i;

     i=a++;

this program will result in value of i = 2 as value of a was increased by 1 after execution of that statement

Similar questions