“++”在不同位置测试用例

++在前与在后的区别测试用例

#include<stdio.h>
//测试++test 和 test++执行的先后顺序
int main()
{
    
    
	int a[10],Test1=2,Test2=2;
	for (int i = 0; i < 10; i++)
	{
    
    
		a[i] = 0;
		printf("%d\t", a[i]);
	}
	printf("\n");
	a[Test1++] = 3;
	for (int i = 0; i < 10; i++)
	{
    
    
		printf("%d\t", a[i]);
	}
	a[++Test2] = 4;
	printf("\n");
	for (int i = 0; i < 10; i++)
	{
    
    
		printf("%d\t", a[i]);
	}
	return 0;

}

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_44039930/article/details/107557293
今日推荐