struct profile
struct data
{ char name[20];
char lastname[20];
char id[15];
float grade;
int age;
struct profile profile;
}student[4];
main()
{ strcpy (student[0].name,"ABC");
strcpy (student[0].lastname,"DFG");
strcpy (student[0].id, "1234567");
student[0].grade=2.50;
student[0].age=19;
-----------------------------------
1. คืออยากทราบว่า char string[] มันสามารถเก็บตัวเลขได้ และ int มันก็สามารถเก็บตัวเลขได้เหมือนกัน ทำถึงไม่ใช้ char string[] แทน int ละครับ
2. structure ซ้อน structure มีประโยชน์อย่างไรครับ
Char string[] กับ int แตกต่างกันอย่างไร
struct data
{ char name[20];
char lastname[20];
char id[15];
float grade;
int age;
struct profile profile;
}student[4];
main()
{ strcpy (student[0].name,"ABC");
strcpy (student[0].lastname,"DFG");
strcpy (student[0].id, "1234567");
student[0].grade=2.50;
student[0].age=19;
-----------------------------------
1. คืออยากทราบว่า char string[] มันสามารถเก็บตัวเลขได้ และ int มันก็สามารถเก็บตัวเลขได้เหมือนกัน ทำถึงไม่ใช้ char string[] แทน int ละครับ
2. structure ซ้อน structure มีประโยชน์อย่างไรครับ