さて、ここでの私の目標は、関数を使用して文字列の配列を設定し、次にそれらの文字列の配列を返すことです。
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int getinfo (char* nam[], int ag[], char* dot[], char* gende[], int x)
{
printf ("What is the student's name?\t");
scanf ("%d", &nam[x]);
printf ("\nWhat is the student's age?\t");
scanf ("%d", &ag[x]);
printf ("\nWhat is the student's Date of Birth?\t");
scanf ("%s", &dot[x]);
printf ("\nWhat is the student's gender?\t");
scanf ("%c", &gende[x]);
printf ("\nWhat is the student's adress?\t");
return nam[x];
}
int main ()
{
int amount, y;
printf("How many students are you admitting?\t");
scanf ("%d", &amount);
char *name[50], *dob[50], gender[50];
int age[50];
for(y = 0; y < amount; y++)
{
getinfo(&name[y], &age[y], &dob[y], &gender[y],y);
}
system("pause");
}