Skip to content

Instantly share code, notes, and snippets.

@tmiller
Last active May 27, 2016 04:03
Show Gist options
  • Save tmiller/30529ef53a1f15258f15ca4ffdad109a to your computer and use it in GitHub Desktop.
Save tmiller/30529ef53a1f15258f15ca4ffdad109a to your computer and use it in GitHub Desktop.
Crop* createCrop(/*... crop fields ...*/) {
// Create and return address of crop
}
enum names {
Garlic;
GreenBeen;
Kale;
Pasnip;
}
int main() {
struct Crop *crops[4];
crops[Garlic] = createCrop(/*... crop fields ...*/)
crops[GreenBean] = createCrop(/*... crop fields ...*/)
crops[Kale] = createCrop(/*... crop fields ...*/)
crops[Parsnip] = createCrop(/*... crop fields ...*/)
// maybe access them like this?
for(int i = 0; i < len(crops); i++ {
*crops[n].Id = 4
}
}
Crop* createCrop(/*... crop fields ...*/) {
// Create and return address of crop
}
int main() {
int Garlic = 0;
int GreenBeen = 1;
int Kale = 2;
int Pasnip = 3;
struct Crop *crops[4];
crops[Garlic] = createCrop(/*... crop fields ...*/)
crops[GreenBean] = createCrop(/*... crop fields ...*/)
crops[Kale] = createCrop(/*... crop fields ...*/)
crops[Parsnip] = createCrop(/*... crop fields ...*/)
// maybe access them like this?
for(int i = 0; i < len(crops); i++ {
*crops[n].Id = 4
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment