摘要
交换两个变量的值是程序设计中一种最基本、最常用的非数值算法。常用的换值算法是通过中间变量 ,基于轮转存储 ,实现交换两个变量的值。本文利用两个逻辑等式 ,提出了一种基于逻辑位运算的换值方法 。
Swapping values of two variables is one kind of basic and frequently-used non-numerical algorithm.The common swapping algorithm is based on a circulating storing by a medium variable to execute swapping values of two variables. By applicating two logistic equations,the swapping algorithm based on logic-bit operation,which directly swaps values of two variables without a medium variable,is presented.
出处
《测控技术》
CSCD
2002年第4期54-54,62,共2页
Measurement & Control Technology