怎么把结构体从主函数掉用到函数啊?

来源:百度知道 编辑:UC知道 时间:2024/06/14 19:27:46
#include<stdio.h>
#include<conio.h>
void input(char a[50][20])
{
char c;
while(c=='N' || c=='n')
{
printf("请输入姓名")
}
}
struct sell_record
{
char name[20];
float income;
};
void main()
{
int count=0;
struct sell_record sells[50];
input(sells);
}
我想把我在主函数掉的结构体掉用到input里,在()里应该写什么啊?
主函数和函数2个都要饿

//---------------------------------------------------------------------------

#include <stdio.h>
#include <stdlib.h>
typedef struct sell_record
{
char name[20];
float income;
}sr;
void input(sr s[],int c);
int main(int argc, char* argv[])
{
sr sells[50];
int count,i;
printf("COUNT=");
scanf("%d",&count);
input(sells,count);
system("cls");
for (i = 0; i<count; i++) {
printf ("NAME:%s\nIncome:%g\n\n",sells[i].name,sells[i].income);
}
system("pause");
return 0;
}
void input(sr s[],int c)
{
int i;
for (i = 0; i<c; i++) {
printf("Name: ");
scanf("%s",&s[i].name);
printf("Income: ");
scanf("%f",&s[i].income );
}
}

//-----------------------------------------------------------