A data structure i created with a function
Code:
#include <stdio.h>
struct
{
char Name[];
char address[];
float SS[];
int age[];
char gender[];
char statues[];
}
void sentence( char struct array[], char buffer[], int X);
main(void)
{
struct info employees[10];
int i=0,num;
printf("How many employees you wish to log?\n");
scanf("%d",num);
if(num > 10){
printf("Error only up to 10\n");
printf("How many employees you wish to log?\n");
scanf("%d",num); }
printf("what are the employees names?\n");
sentence(employees.Name[],num);
printf("What are the addresses?\n");
sentence(employees.address[],num);
printf("What is there sex?\n");
sentence(employees.gender[],num);
printf("is the employees marry or single?\n");
sentence(employees.statues[],num);
for(i=0, i != num, ++ i)
{
printf("What is employees ages?\n");
scanf("%d",&employees.age[60]);
printf("What is employees social security\n");
scanf("%f",&employees.ss[10]);
}
}
void sentence(Char struct array[], char buffer[],int x)
{
int i, z;
char letter;
for(i = 0; i != x; ++ i) {
do
{
letter = getchar();
array[i].buffer[z] = letter;
++ z;
} while(letter != '\n');
array[i].buffer[z-1] = '\0';
printf("%s",array[i].buffer);
}
i have a problem bring a structure into a function...