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