大家好,我是编程新手,我有一个范例,我需要打印一个 struct 类型的指针,该指针在每次迭代中动态获取值,并在每次迭代时打印一个 defrended struct 成员。
struct my_struct
{
int x;
int y;
}
void function(){
my_struct* a=value.get() // some values will be assigned dynamically to this pointer from other part of function.
my_struct* data = new thread_data;
data->x=1 //which will get updated according the iterations and conditions
data->y=2 //which will get updated according the iterations and conditions
}
现在我需要在调用者函数中打印 a,x,y 的值,如何打印这些值。一些喜欢的东西
printf("a=%lx x=%i y=%i\n", a,x,y);
有人可以给我一些想法或如何进行吗?多谢