#include<stdio.h>
int main(){
int num,i=0;
num=-++i+ ++-i;
printf("%d",num);
return 0;
}
I am getting compilation error for above example. I understood like, unary (+) operator returns const value. but below example is not satisfying that condition.
#include<stdio.h>
int main(){
int x,i=1;
x=~-i;
printf("%d",x);
getchar ();
return 0;
}
Here I am getting '0' as answer.
Can anyone explain me, what exactly '+' operator does in c.