My problem is when I call function putfirst.
prototype of putfirst: void putfirst(nodo**, nodo*);
At the end of the code is function putfirst
Code:
global declaration of type
typedef struct nodo {
int codigo;
char pro[30];
float pre;
struct nodo *siguiente;
}nodo;
local pointers
nodo *h=NULL, *x;
x=(nodo *)malloc(sizeof(nodo));
produ=fopen("c:/producto.dat", "rt");
scanf("%d",&producto);
while(producto!=255)
{
rewind(produ);
x=(nodo *)malloc(sizeof(nodo));
while(!feof(produ))
{
fread(&x->codigo,2,1,produ);
fread(x->pro,30,1,produ);
fread(&x->pre,sizeof(float),1,produ);
if(x->codigo==producto)
{
printf("\nproducto encontrado");
break;
}
if(feof(produ))
{
printf("\nNo se encontro el producto, ingreselo manualmente");
printf("\nDescripcion: ");
scanf("%s",x->pro);
printf("\nPrecio: ");
scanf("%f",x->pre);
}
putfirst(&h,x);
scanf("%d",&producto);
}
void putfirst(nodo **ph, nodo *p)
{
p->siguiente=*ph;
*ph=p;
return;
}
code tag's added by your friendly mod