Lesson 22 of 23
Structures (struct)Structures (struct)
11 min 35 XP
struct பல வகை fields-ஐ ஒரு புதிய type-ஆக இணைக்கும், உதாரணமாக ஒரு மாணவரின் பெயர், roll no, மதிப்பெண். typedef மூலம் சுருக்கமான பெயர் வைக்கலாம். Pointer மூலம் field-ஐ அணுக -> பயன்படுத்துங்கள்.
A struct groups fields of different types into a new type, like a student's name, roll number and marks. typedef gives it a short name, and -> accesses a field through a pointer.
Example: edit me and press Run
Press Run to see the result here.struct vs union: union-ல் எல்லா fields-ம் ஒரே memory-ஐப் பகிரும். இந்த வேறுபாடு C interview-களில் கேட்கப்படும்.
struct vs union: in a union all fields share the same memory. Expect this question in C interviews.