+ 1

Post incriment in C

Why whe i give a++ as argument for printf it takes a+1 and not just a. Isnt it just a normal function? https://code.sololearn.com/cK9JXw25bWml/?ref=app

30th Sep 2019, 11:27 AM
mahmoud ettouahri
mahmoud ettouahri - avatar
3 Respuestas
+ 3
the variable x = 5 var = x++ - the var variable will collect the value 5 and then the sum x + 1, ie a = 6 and var = 5 var = ++x - the code adds a + 1 first and then stores the value inside var, ie a = 6 and var = 6
30th Sep 2019, 11:31 AM
Wardy Spirit
Wardy Spirit - avatar
+ 4
Because the print statement is in the next line, after the post increment is done.
30th Sep 2019, 11:29 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
Thank you all ... 😀
30th Sep 2019, 11:33 AM
mahmoud ettouahri
mahmoud ettouahri - avatar