How can I create a user defined data type that could be used to represent a three dimensional vector.
Vector
Author
Message
typedef struct { float x; float y; float z; } vector; ... vector myVector;
Koshchi wrote:
typedef struct { float x; float y; float z; } vector; ... vector myVector;
Thanks for the quick response, but it needs to be a user defined data type and not a structure. So would the following be okay...
typedef float Vector[3];
then say to declare an array of four vectors I could simple say...
Vector image_vector[4];
Maybe I'll stick to the structure... :)
Quote:
Thanks for the quick response, but it needs to be a user defined data type and not a structure.
But that is a user defined data type (that also happens to be a struct). If you want an array instead, your method will work just fine.
Thanks, I think I was barking up the wrongs tree, your way is perfect for what I want....