zoukankan      html  css  js  c++  java
  • 关于数组传递的错误

    unsigned char* getDirectionGray( unsigned char** ptrCenterRow, int j)
    {
        unsigned char p[4]; //如果修改成*p则出现段错误,还没搞懂
    
        p[0] = abs(ptrCenterRow[-1][(j-1)] -ptrCenterRow[0][j]) +
                            abs(ptrCenterRow[1][(j+1)]-ptrCenterRow[0][j]);   
        cout << "d0:" << p[0] <<  endl;
        printf("%d
    ", p[0]);
        p[1] = abs(ptrCenterRow[-1][j]-ptrCenterRow[0][j])+
                            abs(ptrCenterRow[1][j]-ptrCenterRow[0][j]);
        cout << "d1:" << p[1] << endl;
        printf("%d
    ", p[1]);
        p[2] = abs(ptrCenterRow[1][(j+1)]-ptrCenterRow[0][j]) + 
                            abs(ptrCenterRow[1][(j-1)]-ptrCenterRow[0][j]);
        cout << "d2:" << p[2] << endl;
        printf("%d
    ", p[2]);
        p[3] = abs(ptrCenterRow[0][(j-1)]-ptrCenterRow[0][j]) + 
                            abs(ptrCenterRow[0][(j+1)] - ptrCenterRow[0][j]);
        cout << "d3:" << p[3] << endl;
        printf("%d
    ", p[3]);
        cout << "getDirectionGray()" << endl;
        return p;
    
    }
    The Safest Way to Get what you Want is to Try and Deserve What you Want.
  • 相关阅读:
    简单poi创建execl
    Orcale 存储过程实践总结
    PLSQL 创建自定义函数注意事项
    字符串算法模板整理
    多项式FFT/NTT模板(含乘法/逆元/log/exp/求导/积分/快速幂)
    UVALive
    Gym
    Gym
    Kattis
    Kattis
  • 原文地址:https://www.cnblogs.com/Shinered/p/10494922.html
Copyright © 2011-2022 走看看