Created
December 7, 2018 17:33
-
-
Save Azoraqua/89c5052d4c7459482a0729cf2df645fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "example.h" | |
Person* Person__create(char* firstName, char* lastName, unsigned int age) { | |
printf("Creating person with name \"%s %s\" and age %d.", firstName, lastName, age); | |
Person* person = malloc(sizeof(Person)); | |
person->firstName = firstName; | |
person->lastName = lastName; | |
person.age = age; | |
return person; | |
} | |
void Person__destroy(Person* person) { | |
printf("Destroying person (%p)", &person); | |
free(person); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct { | |
char* firstName; | |
char* lastName; | |
unsigned int age; | |
} Person; | |
Person* Person__create(char* firstName, char* lastName, unsigned int age); | |
void Person__destroy(Person* person); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment