- structure : คือชนิดข้อมูลที่คุณเป็นผู้สร้างเอง
- structure : ชนิดข้อมูลที่คุณสร้างขึ้นเองนั้น ทำได้โดยการรวมชนิดข้อมูลพื้นฐาน มาจัดไว้เป็นกลุ่น และตั้งชื่อใหม่
- ชื่อของ struct (ชื่ออะไรก็ตาม) จะถูกเรียกว่า tag หรือ type name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) | |
{ | |
struct student { char name[20] ; int age; } std1 = {"Emily", 18}; | |
struct student std2 = {"Nadia", 19}; | |
printf("%s , %d\n" , std1.name , std1.age); | |
printf("%s , %d\n" , std2.name , std2.age); | |
return 0; | |
} |