[英]how to access array of structure within a structure
struct students
{
char name[256];
int Roll_number;
};
struct colleges
{
char name[256];
Student students[100];
};
如何訪問 student[0].name,我嘗試使用 -> 和 . 操作員不可訪問
#include <stdio.h>
struct students {
char name[256];
int Roll_number;
};
struct colleges {
char name[256];
struct students students[100];
};
int main(void)
{
struct colleges c = { };
printf("%s\n", c.students[0].name);
return 0;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.