cuốn sách gpt4 ai đã làm

c - foo->bar 和 &foo->bar 有什么区别?

In lại Tác giả: Vũ trụ không gian 更新时间:2023-11-04 07:19:48 27 4
mua khóa gpt4 Nike

1. struct thread_args 
{
2. int thread_id;
3. struct timeval before;
4. struct timeval after;
}

5. void * foobar(void *threadargs)
{
6. struct * mydata;
7. mydata = (struct thread_args *) threadargs;

8. gettimeofday(&mydata->before, NULL);
9. gettimeofday(mydata->before, NULL);
}

...

第 8 行和第 9 行有什么区别?前者编译,后者不编译,但即使第一个编译,我也不确定它是否按照我的要求进行。

câu trả lời hay nhất

foo->bar = 结构变量 foo 中的变量 thanh 包含的值。

&foo->bar = 结构变量 foo 中变量 thanh Địa chỉ.

Xem cái này operator precedence table .

gettimeofday()需要 struct timeval * 类型的第一个参数。所以 gettimeofday(mydata->before, NULL); 不编译。

关于c - foo->bar 和 &foo->bar 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22234405/

27 4 0
không gian vũ trụ
Hồ sơ

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá taxi Didi miễn phí
Phiếu giảm giá taxi Didi
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress