I am very confused in this code. I get confused because if I declare my functions first before the structures the error that appears to me is
: 6: 13: error: unknown type name 'patient'
Putting the functions before the structures.
#include <stdio.h>
#include <ncurses.h>
#include <stdlib.h>
int menu();
void datos (paciente pac[]);
typedef struct signos_vitales
{
int glucosa;
float temperatura;
float presion_d;
float presion_s;
int pulso;
}signos_vitales;
typedef struct paciente
{
char paterno[50];
char materno[50];
char nombre[50];
int edad;
char sexo;
bool asegurado;
signos_vitales signos;
}paciente;
main()
{
int num, m, seg, hiper, hipo;
printf("Cuantos pacientes quieres registras\n");
scanf("%d", &num);
paciente pac[num];
m = menu();
switch(m)
{
case 1:
datos(pac);
break;
}
}
But if I change the order and put the functions after the structures, when compiling, the error changes and this appears to me.
In function main:
hospital.c :(. text + 0x87): undefined reference to menu '
:( hospital.c text + 0x9E). Undefined reference to data '
collect2: error: ld returned 1 exit status
What am I doing wrong?