新的软件使用:codeblocks(下载、配置以及如何调试一个程序,查看变量)

为了运行https://leetcode-cn.com/explore/interview/card/top-interview-questions-easy/1/array/21/上面的程序。

为此下载了编译器。

如下:

官方网站下载:http://www.codeblocks.org/downloads/26

下载无安装版本:

打开后的界面如下

出现的问题:

ERROR: You need to specify a debugger program in the debuggers's settings.
(For MinGW compilers, it's 'gdb.exe' (without the quotes))

(For MSVC compilers, it's 'cdb.exe' (without the quotes))

 

网上查找配置:

1:https://stackoverflow.com/questions/21083560/how-do-you-specify-a-debugger-program-in-codeblocks-12-11/33289596

整理好了,但是会出现只能运行一次:

解决参考:http://tieba.baidu.com/p/3491019377

配置界面:

A:

B:

注意选择的是:gdb.32

例如:

2、官方参考的安装教程:

http://wiki.codeblocks.org/index.php?title=MinGW_installation#TDM-GCC

上面所运行的代码:

#include <stdio.h>
#include <stdlib.h>
int array[10]={0,0,1,1,1,2,2,3,3,4};
int size=10;
int j=0;
int main()
{
 for (int i=0;i<size-1; i++)
   {
        while (array[i] == array[i+1])
        {
           i++;
        }
        array[j++] = array[i];
        i--;
   }
   return j;
    printf("Hello world!\n");
    return 0;

}

运行调试完成的界面:

如何调试参考:http://www.docin.com/p-894823578.html

完成!

应该使用下面的C代码:

#include <stdio.h>
#include <stdlib.h>
int array[10]={0,0,1,1,1,2,2,3,3,4};
int size=10;
int j=0;
int main()
{

  for(int i=0;i<size;i++)
  {

      while(array[i]==array[i+1])
      {
          i++;
      }
      array[j++]=array[i];
        //i--;
  }
    return j;
//    printf("hello world 7\n");
//    return 0;
}

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

heda3

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值