Estoy tratando de hacer esto:
typedef struct { float x; float y; } coords; struct coords texCoordinates[] = { {420, 120}, {420, 180}};
Pero el comstackdor no me deja. : (¿Qué hay de malo con esta statement? ¡Gracias por su ayuda!
O bien hacer
typedef struct { float x; float y; } coords; coords texCoordinates[] = { {420, 120}, {420, 180}};
O
struct coords { float x; float y; }; struct coords texCoordinates[] = { {420, 120}, {420, 180}};
En C, los nombres de las struct
residen en un espacio de nombres diferente al de typedef
s.
Por supuesto, también puede usar typedef struct coords { float x; float y; } coords;
typedef struct coords { float x; float y; } coords;
y use ya sea struct coords
o coords
. En este caso, no importará lo que elija, pero para las estructuras de auto-referencia necesita un nombre de estructura:
struct list_node { struct list_node* next; // reference this structure type - need struct name void * val; };