Define datos de esta forma y fuera de la función:
Saludos.
Código (c) [Seleccionar]
typedef struct articulos
{
int codigo;
char art[50];
int cantidad;
float precio;
}datos __attribute__ ((packed));
Saludos.