C语言—i++、++i、条件运算符、goto语句、注释

++i和i++

#include 
int main()
{
	int i=5,j;

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

	i = 5;
	j = i++;
	printf("i=%d,j=%d\n", i, j);
	
	system("pause");

	return 0;

}
i=6,j=6
i=6,j=5
请按任意键继续. . .

条件运算符

C语言—i++、++i、条件运算符、goto语句、注释_第1张图片

goto语句

#include 
int main()
{
	int i = 5;

	while (i++)
	{
		if (i > 10)
		{
			goto Label;
		}
	}

Label: printf("Here,i=%d\n", i);

	system("pause");

	return 0;
}
Here,i=11
请按任意键继续. . .
开发中要慎用goto语句。

C语言—i++、++i、条件运算符、goto语句、注释_第2张图片

注释

不合理的注释

C语言—i++、++i、条件运算符、goto语句、注释_第3张图片
C语言—i++、++i、条件运算符、goto语句、注释_第4张图片

合理注释参考

https://blog.csdn.net/weixin_40962970/article/details/115005630?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522169984104916800180651855%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=169984104916800180651855&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_ecpm_v1~rank_v31_ecpm-4-115005630-null-null.142v96pc_search_result_base1&utm_term=C%E8%AF%AD%E8%A8%80%E5%90%88%E7%90%86%E7%9A%84%E6%B3%A8%E9%87%8A&spm=1018.2226.3001.4187

你可能感兴趣的:(c语言,算法,开发语言)