形式参数1的修复类型不完整 [英] Fix type of formal parameter 1 is incomplete|
问题描述
问题似乎与PrintInv功能有关。
#include< stdio.h>
#include< string .h>
void PrintInv(struct PartItem);
typedef struct PartItem
{
char Number [10];
浮动价格;
int数量;
};
int main()
{
struct PartItem Part;
strcpy (Part.Number,SMS0001);
Part.price = 0.35;
Part.Qty = 20;
printf(%s \ n%f \ n%d,Part.Number,Part.price,Part.Qty);
struct PartItem OldPart;
printf(\ n输入旧零件编号\ n);
scanf(\ n%s,OldPart.Number);
printf(\ n输入旧零件价格\ n);
scanf(\ n%f,& OldPart.price);
printf(\ n输入数量\ n);
scanf(%d, & OldPart.Qty);
PrintInv(部分);
PrintInv(OldPart);
}
PrintInv(struct PartItem Prt)
{
printf(%s \ t%.2f \t%d \ t%。2f \ n,Prt.Number,Prt.price,Prt.Qty,Prt.price * Prt.Qty);
// printf( %s%.2f%d%.2f \ n,Part.Number,Part.price,Part.Qty,Part.price * Part.Qty);
// printf(% s%。2f%d%.2f,OldPart.Number,OldPart.price,OldPart.Qty,OldPart.price * OldPart.Qty);
} //结束processEmp
我尝试了什么:
如果删除printinv功能代码则工作
The problem seems to be with the PrintInv function.
#include <stdio.h>
#include <string.h>
void PrintInv(struct PartItem);
typedef struct PartItem
{
char Number[10];
float price;
int Qty;
};
int main()
{
struct PartItem Part;
strcpy (Part.Number, "SMS0001");
Part.price = 0.35;
Part.Qty = 20;
printf("%s\n%f\n%d", Part.Number, Part.price,Part.Qty);
struct PartItem OldPart;
printf("\n Enter old part number\n");
scanf("\n%s", OldPart.Number);
printf("\n Enter old part price\n");
scanf("\n%f", &OldPart.price);
printf("\n Enter the quantity\n");
scanf("%d", &OldPart.Qty);
PrintInv(Part);
PrintInv(OldPart);
}
PrintInv(struct PartItem Prt)
{
printf("%s\t%.2f\t%d\t%.2f\n", Prt.Number, Prt.price, Prt.Qty, Prt.price*Prt.Qty);
// printf("%s %.2f %d %.2f\n", Part.Number,Part.price, Part.Qty, Part.price*Part.Qty);
//printf("%s %.2f %d %.2f", OldPart.Number,OldPart.price, OldPart.Qty, OldPart.price*OldPart.Qty);
} //end processEmp
What I have tried:
if I remove the printinv funtion code works
推荐答案
您在使用之前是否尝试定义结构?
Did you try to define the structure before using it ?
typedef struct PartItem
{
char Number[10];
float price;
int Qty;
};
void PrintInv(struct PartItem);
使用C,元素的顺序很重要。
With C, the order of elements matters.
这篇关于形式参数1的修复类型不完整的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!