Lesson 22 of 23
Structures (struct)
11 min 35 XP
struct ಬೇರೆ ಬೇರೆ types ನ fields ಅನ್ನು ಒಂದು ಹೊಸ type ಆಗಿ ಗುಂಪು ಮಾಡುತ್ತದೆ, ವಿದ್ಯಾರ್ಥಿಯ ಹೆಸರು, roll number ಮತ್ತು ಅಂಕಗಳಂತೆ. typedef ಅದಕ್ಕೆ ಚಿಕ್ಕ ಹೆಸರು ಕೊಡುತ್ತದೆ, -> pointer ಮೂಲಕ field ತಲುಪುತ್ತದೆ.
Example: edit me and press Run
Output Loading C (first time takes a few seconds)
Press Run to see the result here.struct vs union: union ನಲ್ಲಿ ಎಲ್ಲಾ fields ಒಂದೇ memory ಹಂಚಿಕೊಳ್ಳುತ್ತವೆ. C interviews ನಲ್ಲಿ ಈ ಪ್ರಶ್ನೆ ನಿರೀಕ್ಷಿಸಿ.