-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3363489
commit c2b12cb
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <stdlib.h> | ||
#include "dog.h" | ||
|
||
/** | ||
* free_dog - frees dogs | ||
* @d: pointer to dog to free | ||
* | ||
* Return: void | ||
*/ | ||
void free_dog(dog_t *d) | ||
{ | ||
if (d) | ||
{ | ||
free(d->name); | ||
free(d->owner); | ||
free(d); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <stdio.h> | ||
#include "dog.h" | ||
|
||
/** | ||
* main - check the code | ||
* | ||
* Return: Always 0. | ||
*/ | ||
int main(void) | ||
{ | ||
dog_t *my_dog; | ||
|
||
my_dog = new_dog("Poppy", 3.5, "Bob"); | ||
printf("My name is %s, and I am %.1f :) - Woof!\n", my_dog->name, my_dog->age); | ||
free_dog(my_dog); | ||
return (0); | ||
} |