小编Dav*_*vid的帖子

为什么围绕函数参数括号?

我正在从计算机系统程序员的角度研究2.1节,我理解代码在做什么,但我不明白为什么围绕形式参数"byte_pointer"后跟&x有括号?

typedef unsigned char *byte_pointer;

void show_bytes(byte_pointer start, int len) {
    int i;
    for (i = 0; i < len; i++)
        printf(" %.2x", start[i]);
    printf("\n");
}

void show_float(float x) {
    show_bytes((byte_pointer) &x, sizeof(float));
}

void show_int(int x) {
    show_bytes((byte_pointer) &x, sizeof(int));
}

void show_pointer(void *x) {
    show_bytes((byte_pointer) &x, sizeof(void *));
}
Run Code Online (Sandbox Code Playgroud)

c parameters function

2
推荐指数
1
解决办法
104
查看次数

标签 统计

c ×1

function ×1

parameters ×1