我是C ++的新手,我正在使用Arduino平台。我正在为我的项目编写程序,有一次我需要将笛卡尔坐标系转换为圆柱坐标系。该程序采用大小为3的float数组并对其进行处理,然后返回一个大小为3的新float数组,并带有另一个系统中的坐标。我一直收到错误消息“退出状态1,无法将'float *'转换为'float'作为回报”,我完全不知道我的代码有什么问题或如何解决。有人可以帮我了解发生了什么事吗?
float CartesianToCylindrical (float pos[]){ //pos is in the form of [x,y,z]//
float cylpos[3];
cylpos[0] = sqrt((pos[0] ^ 2) + (pos[1] ^ 2));
cylpos[1] = atan(pos[1] / pos[0]);
cylpos[2] = pos[2];
return cylpos; //return in the form of [r,theta,z]//