Saturday 16 March 2013

Unary + operator


main()
    {
    int i=-1;
    +i;
    printf("i = %d, +i = %d \n",i,+i);
    }
Answer:
 i = -1, +i = -1
Explanation:
Unary + is the only dummy operator in C. Where-ever it comes you can just ignore it just because it has no effect in the expressions (hence the name dummy operator).

Blog Author: Vijay Kumar

Go to: Java Aptitude


No comments:

Post a Comment