!! 主要用于在value 为真时候, 返回1。
#include
int main(int argc, char *argv[])
{
/* if test is not eque 0, !! is used to get true value(1) */
int test = 10;
printf("test_1 = %d\n", test);
printf("!test_1 = %d\n", !test);
printf("!!test_1 = %d\n", !!test);
/* if test is 0, !! is not meanful */
int test_2 = 0;
printf("test_2 = %d\n", test_2);
printf("!test_2 = %d\n", !test_2);
printf("!!test_2 = %d\n", !!test_2);
return 0;
}
chechunli@chechunli-PC:~ $ ./test
test_1 = 10
!test_1 = 0
!!test_1 = 1
test_2 = 0
!test_2 = 1
!!test_2 = 0
阅读(474) | 评论(0) | 转发(0) |