I come, I see, I conquer

                    —Gaius Julius Caesar

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

1. What will be the output of the following code ?

#include <stdio.h>

int main() 
{
    
int i = 3, j = 4;
    i 
? i++ : ++j;
    printf(
"i=%d, j=%d \n", i, j);
}



2. What will be the output of the following C code ?

#include <stdio.h>
#define product(x) (x*x)

int main() 
{
    
int i = 3, j, k;

    j 
= product(i++);
    k 
= product(++i);

    printf(
"j=%d, k=%d \n", j, k);

    
return 0;
}



3. What will be the output of the following code?

#include <stdio.h>

int main() 
{
    
int i = 5, j = 3;
    
!&& ++j;
    printf(
"i=%d, j=%d \n", i, j);
}
posted on 2008-10-12 09:13  jcsu  阅读(400)  评论(0编辑  收藏  举报