当前位置:Gxlcms > 数据库问题 > Visual studio调试和在linux gdb调试的尝试

Visual studio调试和在linux gdb调试的尝试

时间:2021-07-01 10:21:17 帮助过:44人阅读

 

 

#include "stdafx.h"
#include <stdio.h>
#include <string.h>

const char* str[] = { "Hello","abc","applef","man","C程序设计","指针数组","1","2","3" };
const char* pdest = "指针数组";


int main()
{
    int i;
    int ret = -1;
    const char * * p = str;
    for (i = 0; i < sizeof(str) / sizeof(char*); i++)
    {

#if 0 
        if (strcmp(*p++, pdest) == 0)
        {
            printf("we are found dest\n");
            break;
        }
#endif 


        p = p + i;  // 这样是错误的   p的变化太大 指针越界



    }
    printf("\n");        
    printf("i = %d\n", sizeof(str) / sizeof(char*));

    while (1);

    return 0;
}


技术图片

  查看变量的值是:     添加监视  就知道变量的值什么回事     

技术图片

 

Visual studio调试和在linux gdb调试的尝试

标签:设计   判断   main   print   i++   font   结果   turn   image   

人气教程排行