实例:反序输出字符串
程序源码:
#include <stdio.h>
int main(int argc, char const *argv[])
{
char s[32];
scanf_s("%s",s, sizeof(s));
int i = 0, j = 0;
while (s[i])
++i;
char t;
while (--i > j)
{
t = s[i];
s[i] = s[j];
s[j] = t;
++j;
}
return 0;
}
程序调试:
通过逐步运行,监视循环中每一个变量值的改变,可以很清晰的了解整个程序的运行。
监视:
学习体验:通过学会调试方法,能够更清晰的理解程序的运行过程。