Struct In C | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Struct In C

Why would you use struct in C it seems like something that you wouldn’t use often.

9th Nov 2020, 5:56 PM
Whats My True Name???
Whats My True Name??? - avatar
3 Antworten
+ 1
No, we need Structures very often in real life programming. Just think like, you are asked to program an attendance sheet for a school. Now, won't it help you if you had a way to bundle the student's name and roll number into a single variable? Well, that's one case where structures are used. Generally, data structures are useful in programming. So try to learn them. Happy learning ;)
31st Jul 2021, 7:36 AM
Rishi
Rishi - avatar
+ 1
Whats My True Name??? Yeah you are right. Well then, think of this situation then. You are designing a game, for that you have to make a data structure which holds the player's hit points, attack and number of items in inventory, into a single variable. A structure would be helpful there. The point is, structures, in general, data structures are helpful in making complex data structures out of fundamental types
1st Aug 2021, 1:51 AM
Rishi
Rishi - avatar
0
But if you were going to program an attendance sheet wouldn’t SQL or Python be a better fit since they are better suited for data science and alike.
31st Jul 2021, 8:08 AM
Whats My True Name???
Whats My True Name??? - avatar