码迷,mamicode.com
首页 > 编程语言 > 详细

指针数组学习

时间:2019-04-30 14:11:25      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:data   指针数组   col   color   member   sizeof   mem   repr   value   

int Rawdata_PreProcess(const void **in_frame, int n, int frame_size, void *out_frame)
{
    const short **iframe = (const short **)in_frame;
    short *oframe = (short *)out_frame;
    int member = frame_size / sizeof(short);

    for (int m = 0; m < member; m++) {
        int sum = 0;
        for(int i = 0; i < n; i++) {
            short point = iframe[i][m];
            printf("frame:%d, index:%d, value:%d\n", i, m, (int)point);
            sum += point;
        }
        oframe[m] = sum / n;
    }
    return 0;
}

short frame1[4] = {1, 4, 6, 7};
short frame2[4] = {3, 6, 2, 9};
short frame3[4] = {1, 5, 3, 4};

short out[4];

int main(void)
{
    short *group[3] = {frame1, frame2, frame3};
    Rawdata_PreProcess(group, 3, 8, out);
    printf("a:%d, b:%d, c:%d, d:%d\n", out[0], out[1], out[2], out[3]);
}

 

指针数组学习

标签:data   指针数组   col   color   member   sizeof   mem   repr   value   

原文地址:https://www.cnblogs.com/hjj-fighting/p/10795542.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!