Ciao a tutti, sto facendo un programma con scopi didattici, e ottengo 2 errori in fase di compilazione che non capisco:
componenti.c: In function ‘main’:
componenti.c:20: error: expected expression before ‘int’
componenti.c:20: error: too few arguments to function ‘build_component’
Vi posto il codice:
funzioni.h
codice:
struct component {
int ID;
int family;
int cost;
int length;
int height;
};
struct component build_component(int i, int f, int c, int l, int h);
funzioni.c
codice:
#include "funzioni.h"
struct component build_component(int i, int f, int c, int l, int h) {
struct component scheda;
scheda.ID = i;
scheda.family = f;
scheda.cost = c;
scheda.length = l;
scheda.height = h;
return scheda;
}
componenti.c
codice:
#include <stdio.h>
#include <stdlib.h>
#include "funzioni.h"
int main (void) {
int *p, id, fam, cost, lungh, alt;
char c;
p = calloc(1, sizeof(struct component));
do {
scanf("%c", &c);
switch(c) {
case 'c': scanf("%d%d%d%d%d", &id, &fam, &cost, &lungh, &alt);
p = build_component(int id, int fam, int cost, int lungh, int alt);
break;
case 'a': printf("prova speriamo bene\n");
break;
}
} while(c != 'f');
return 0;
}
Qualcuno saprebbe dirmi da cosa derivano?
Grazie