[英]Change point coordinates
I need help solving this problem in my mind so if anyone had a similar problem it would help me.我需要帮助解决这个问题,所以如果有人有类似的问题,它会对我有所帮助。
We have one point in the function main
, which represents the center of the coordinate system with a certain name O(0,0)
, how to use the function function
to change that point in A(1,2)
?我们在 function
main
中有一个点,它代表具有特定名称O(0,0)
的坐标系的中心,如何使用 function function
来更改A(1,2)
中的那个点?
Here's my code:这是我的代码:
struct Point {char m;float x, y;};
void function(struct Point t, char s,float array[2])
{
t.m=s;
t.x=array[0];
t.y=array[1];
}
int main()
{
float array[]={1,2};
struct Point t1={'O',0,0};;
function(t1,'A',array);
printf("%c(%.2f,%.2f)",t1.m,t1.x,t1.y);
return 0;
}
Note the function function
must have a prototype function(struct Point t,char s,float array[2]);
注意 function
function
必须有原型function(struct Point t,char s,float array[2]);
Thanks in advance!提前致谢!
Best regards!最好的祝福!
It cannot be done.这是不可能的。 The provided function prototype provides no way to return any modified values to its callers other than floats.
所提供的 function 原型无法将任何修改后的值返回给除浮点数以外的调用者。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.