0
C Structure Examples
I'm no programmer as such, but I am familiar with C. Does anyone know of a resource that gives a collection of functional (i.e. real world) examples of C structures?
4 Antworten
+ 2
If you've seen the examples, may I offer a different persepctive:
You've so far probably been writing code line for line to solve challenge problems from website X and those are usually like puzzles that need a clever algorithm and less about how you structure larger chunks of code.
In "real life" code we want to solve many problems and be flexible about it - the usual planning step is thinking about the types of data we have, and then what operations we want to do on them.
So if you're writing a phone book management software your type of data is "lists of contacts", and your operations are add, remove, etc. So that warrants a struct called `contact` and then some functions that take lists of `contact*` and modify them.
Structs are so ubiquitous, if you look into any github project written in C you will find a few to a few hundred. I've given a pretty basic "student" example too but it's hard to be more meaningful. You're writing a card game? Make some structs `card`, `hand`, `player`, `deck`, ...
0
~ swim ~ absolutely I don't properly understand them. I have been Googling but I was wondering if others knew of good examples. I've seen the "student" examples but would like to see more in depth examples as well. Thanks for your input, it helped me understand how my question was lacking.