c - "Simplify"到一行

标签 c obfuscation

刚刚做作业发现了这篇文章

A[j]=A[j-1];
j--;

有没有办法将其简化为一行? 编辑一条语句?

我已经尝试过

A[j--]=A[j];

但是好像效果不太好。

代码来自InsertSort算法

编辑这个问题不需要做我的作业,我只是好奇

最佳答案

来自标准:

Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be read only to determine the value to be stored.

A[j] = A[--j];将导致未定义的行为。不要这样做。 A[j]=A[j-1]; j--;非常清晰、简洁且令人满意。

关于c - "Simplify"到一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4546631/

相关文章:

c - Windows 上的 clang 中缺少 M_PI_2

css - 如何使用 UiBinder 声明依赖样式名称

javascript - 高级语法 : "0[constructor][constructor]()()" - How does it works to evaluate code?

c# - 两个方法返回不同类型无参数,如何调用?

c - 阅读 x86 汇编代码

c - 问题中函数无法返回 returnSize 数组中的元素

asp.net - 部署时如何保护/混淆/等 ASP.NET MVC 应用程序的源代码?

java - proguard 试图混淆使用 Spring 的代码时遇到问题

c - float 一个( float );意义?

c - 二传手中的自由字符串