The output of this program will be:

first: i= 4, j= 4 second: i= 6, j= 6 third: i= 6, j= 5

Explanation:

  • In the first line, the ternary operator is used to determine whether to increment i or j. Since i is not equal to 0, i++ is executed, and i becomes 4 while j remains at 4.
  • In the second line, both i and j are incremented twice, since the post-increment operator is used twice. Therefore, i becomes 6 and j becomes 6.
  • In the third line, i remains at 6 while j is incremented by 1, becoming 5. This is because the post-increment operator is used with j.
int main()
{
 int i=3,j=4;
 i?i++:++j;
 printf(

原文地址: https://www.cveoy.top/t/topic/xud 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录