0
这可能看起来像一个简单的问题,但编译时出现错误。我希望能够枚举传递到一个方法C.在C中传入枚举
枚举
enum TYPES { PHOTON, NEUTRINO, QUARK, PROTON, ELECTRON };
调用方法
makeParticle(PHOTON, 0.3f, 0.09f, location, colour);
方法
struct Particle makeParticle(enum TYPES type, float radius, float speed, struct Vector3 location, struct Vector3 colour)
{
struct Particle p;
p.type = type;
p.radius = radius;
p.speed = speed;
p.location = location;
p.colour = colour;
return p;
}
我正的错误是我打电话时的方法:
不兼容的类型分配
大多数人称之为“功能”而不是“方法”,但我们都知道你在说什么。 – 2009-04-30 22:48:12