Skip to content

Instantly share code, notes, and snippets.

@fabioyamate
Created May 12, 2014 22:10
Show Gist options
  • Save fabioyamate/9da149039d66f5813667 to your computer and use it in GitHub Desktop.
Save fabioyamate/9da149039d66f5813667 to your computer and use it in GitHub Desktop.
struct in C
struct my_struct lookup(int count, const struct my_struct coll[], char value[]) {
int i;
for (i = 0; i < count; ++i) {
if (strcmp(coll[i].attr, value) == 0) {
return coll[i];
}
}
return NULL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment