Skip to content

Instantly share code, notes, and snippets.

@pastagatsan
Created June 23, 2014 17:40
Show Gist options
  • Save pastagatsan/96d4b5facea4f576cdd8 to your computer and use it in GitHub Desktop.
Save pastagatsan/96d4b5facea4f576cdd8 to your computer and use it in GitHub Desktop.
#include <stdio.h>
typedef struct
{
int plebeianness;
char * name;
} pleb;
void print_pleb(pleb p);
void bigger_pleb(pleb a, pleb b);
int main()
{
pleb vivid = {12, "vivid"};
pleb hollinski = {9001, "Hollinski"};
print_pleb(vivid);
print_pleb(hollinski);
bigger_pleb(vivid, hollinski);
return 0;
}
void print_pleb(pleb p)
{
printf("%s's plebeianness level is %d\n", p.name, p.plebeianness);
}
void bigger_pleb(pleb a, pleb b)
{
if (a.plebeianness > b.plebeianness)
printf("%s is a bigger pleb than %s\n", a.name, b.name);
else if (a.plebeianness < b.plebeianness)
printf("%s is a bigger pleb than %s\n", b.name, a.name);
else
printf("They are both equally plebeian.\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment