-2
나는이 같은 구조체 뭔가를 사용하는 동안 사람의 배열을 만들 필요가 : -C에서 구조체를 사용하는 사람들의 배열?
typedef struct Person
{
int age; //needs to be randomly generated
int height; //needs to be randomly generated
int weight; //needs to be randomly generated
} Person;
하지만 같은 배열이 작업을 수행하는 방법을 메신저 확실하지 : -
인 [0]
인 [1]
인 [2]
모든 팁 잘 될 것입니다!
'사람이 자동 메모리에 할당하거나'Person * people = malloc (N * sizeof * persons)'을 동적으로 할당합니다. –
당신의 구조체는'Person persons [10];과'persons [0] .age = 10;'(구조체의 다른 요소들도 마찬가지입니다)에 액세스 할 수 있습니다. – AntonH
[C의 배열] (https://www.google.com/search?q=array+in+c&oq=array+in+c&aqs=chrome..69i57j69i60l3j0l2.1215j0j1&sourceid=chrome&espv=210&es_sm=122&ie=UTF-8) –