C中的代码分析 [英] Analysis of code in C

查看:75
本文介绍了C中的代码分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释一下这段代码:



Could someone explain this code:

#include <stdio.h>
#define MAX 10
int main()
{
char array[MAX][MAX], c = 0;
int d = 1, x = 0, i, j;
do scanf("%s", array[x]);
while (array[x++][0] != '0');
{
float* pf;
int xx, *pi = (int*)&array[0][7];
xx = ((*pi) & 0x41000000);
pf = (float*)&xx;
printf("%5.2f\n", *pf);
}
for (c-=--x; c++&**array; d+=!(c<<x>0)) d<<=1;
d -= c;
for (i = 0; i < x;
i==1?printf("%c ", array[i][x>>1]):i, ++i)
for (j = 0; j <= x - i;
printf("%c", array[i][j++]));
printf("%x", d);
return 0;
}





示例输入:代码项目

输出:2.00

codprr 6



我用代码块调试它,但不明白它是如何工作的。您建议使用哪些调试工具?



Example input: code project
Output: 2.00
codprr 6

I debugged it with Code Blocks, but didn't understand how it works. What tools for debugging would you suggest?

推荐答案

我建​​议使用gdb调试器来运行和跟踪每个变量。使用它在不同的点停止。

否则使用括号很好地格式化它并在带有断点的Visual Studio中运行。观察每个循环中的每个变量。
I would suggest using gdb debugger to run and trace each variable. Use it to stop at different points.
Else format it nicely with brackets and run in Visual Studio with breakpoints. Watch each variable in each loop.


这篇关于C中的代码分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆