Can the Unary - - be used as prefix and postfix in both the languages C and C++ ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can the Unary - - be used as prefix and postfix in both the languages C and C++ ?

I was told it is not and there are compiler differences. Like to know if this is true.

20th Oct 2017, 1:28 AM
Antony Marianathan
Antony Marianathan - avatar
1 Answer
+ 5
If - - that is not unary operator that is Arithemic + Unary but if -- that is truly unary operator and can be used as both prefix and postfix int C = 2; printf("%i",C++);C=2; printf("%i",++C);
20th Oct 2017, 2:47 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar